Sha256: 842a66f311dc00ce18a989f21d1eaf62269df587e9d76e2ee0ec856f466abd30
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require 'fileutils' require 'pty' namespace :webpack_manifest_plugin do desc 'Deletes all files in <app root>/public/assets.' task :clean do app_root = WebpackManifestPlugin.app_root.to_s folder = File.join(app_root, 'public/assets') if !app_root.empty? && Dir.exist?(folder) FileUtils.remove_entry_secure(folder, secure: true) else puts "Directory #{folder} not found." end end desc "Run webpack. Assumes webpack is installed at node_modules/webpack/bin/webpack. Use with or without options. Examples: rake webpack_manifest_plugin:build rake webpack_manifest_plugin:build['-d --config webpack.config.prod.js']" task :build, :options do |_t, args| cmd = "#{WebpackManifestPlugin.configuration.webpack_cmd} #{args[:options]}" puts "Executing #{cmd}..." begin PTY.spawn(cmd) do |stdout, _stdin, _pid| begin stdout.each { |line| print line } rescue Errno::EIO puts 'The process has finished.' end end rescue PTY::ChildExited puts 'webpack exited!' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webpack_manifest_plugin-0.1.0 | lib/webpack_manifest_plugin/tasks/main.rake |