我有一个JS插件的文件夹,我想连接并使用Guard和UglifyJS缩小为一个plugins.js文件
到目前为止,这是我在Guardfile中的内容
guard 'uglify', :input => 'js-unprocessed/plugins/*.js', :output => "assets/plugins.js" do watch 'js-unprocessed/plugins/*.js' end当我在plugins目录中保存一个JS文件但我没有在控制台中获得任何反馈并且没有更新或创建文件时,我希望会发生一些事情。
如果您认为Guard和UglifyJS不适合这项工作,请告诉我。
I have a folder of JS plugins that i would like to concatenate and minify into a plugins.js file using Guard and UglifyJS
Here's what I have in my Guardfile so far
guard 'uglify', :input => 'js-unprocessed/plugins/*.js', :output => "assets/plugins.js" do watch 'js-unprocessed/plugins/*.js' endI'd expect something to happen when I save one of the JS files in the plugins directory but I don't get any feedback in the console and no files are updated or created.
Please let me know if you think Guard and UglifyJS are not the right tools for the job.
最满意答案
我使用了https://github.com/guard/guard-jammit 。
我需要添加一个config/assets.yml文件:
embed_assets: on javascripts: plugins: - js-unprocessed/plugins/*.js然后将其添加到我的Guardfile
guard :jammit, :output_folder => "assets/" do watch(%r{^js-unprocessed/plugins/(.*)\.js$}) endI used https://github.com/guard/guard-jammit which did the trick.
I needed to add a config/assets.yml file with this:
embed_assets: on javascripts: plugins: - js-unprocessed/plugins/*.jsand then added this to my Guardfile
guard :jammit, :output_folder => "assets/" do watch(%r{^js-unprocessed/plugins/(.*)\.js$}) end更多推荐
发布评论