Reputation: 25062
I am trying to use the usemin
plugin to minify and create my distributable. Here is my Gruntfile.js
:
module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
dirs: {
dist: 'dist',
app: 'app'
},
clean: {
dist: '<%= dirs.dist %>/*'
},
jshint: {
gruntfile: 'Gruntfile.js',
sources: '<%= dirs.jshint %>',
options: {
jshintrc: '.jshintrc'
}
},
useminPrepare: {
options: {
dest: '<%= dirs.dist %>'
},
html: '<%= dirs.app %>/index.html'
},
usemin: {
options: {
assetsDirs: ['<%= dirs.dist %>']
},
html: ['<%= dirs.dist %>/{,*/}*.html'],
css: ['<%= dirs.dist %>/styles/{,*/}*.css']
}
});
grunt.registerTask('build', ['clean:dist', 'jshint', 'useminPrepare', 'usemin']);
};
I can see my files being minified and uglified in the console, but nothing ever appears in my dist
directory. It is always empty. What is the configuration that I am missing? Also, if I am not doing anything more than what the usemin
plugin is doing, do I need useminPrepare
and usemin
?
Upvotes: 0
Views: 984
Reputation: 156
You'll need to add concat, uglify to your tasklist. Usemin will prepare config, so you don't need to do that yourself - but still need them.
ex.
grunt.registerTask('use', ['useminPrepare','usemin','concat','uglify']);
Upvotes: 2