I've just scaffolded an Angular app using Yeoman. I've noticed that the build
task does several things by default, including minifying and concatenating js files.
I'd like to have a simpler build task that didn't do any minifying or concatenation, and, instead, only did the following two things:
- pile my .scss into .css
- copy a working app into my distribution directory
Can anyone help me write a grunt task that will do (only) these two things?
Many thanks.
I've just scaffolded an Angular app using Yeoman. I've noticed that the build
task does several things by default, including minifying and concatenating js files.
I'd like to have a simpler build task that didn't do any minifying or concatenation, and, instead, only did the following two things:
- pile my .scss into .css
- copy a working app into my distribution directory
Can anyone help me write a grunt task that will do (only) these two things?
Many thanks.
Share Improve this question edited Dec 27, 2013 at 15:55 dB' asked Dec 17, 2013 at 19:13 dB'dB' 8,35016 gold badges61 silver badges108 bronze badges 5- 3 What's your gruntfile look like? You should just be able to remove the tasks you don't want to run. – brbcoding Commented Dec 17, 2013 at 19:14
- Ok, I've added the gruntfile. – dB' Commented Dec 17, 2013 at 19:25
-
well, in the gruntfile you diplayed the
cssmin
task is mented out although you're calling it. Pretty sure that's related. – Geert-Jan Commented Dec 17, 2013 at 19:39 - btw, aren't you just looking for a dev-build instead of a prod-build? I'm pretty sure (not 100%) yeoman will support both targets (dev and build) with the flip of a switch. – Geert-Jan Commented Dec 17, 2013 at 19:41
- Thanks @Geert-Jan. Unmenting cssmin was a step in the right direction. Yes, I'm trying to do a sort of dev-build instead of a prod-built. I couldn't figure out how to get Grunt to do this out of the box, though, so I rolled my own solution. See below. – dB' Commented Dec 17, 2013 at 21:35
1 Answer
Reset to default 8Ok, I've edited the default grunt file so that it does what I want.
My solution involved writing tasks called copy:devDist
and pass:devDist
, and then bining them into a devDist
task.
//
// copy:devDist --> copies everything into the dist folder, except styles/
//
copy: {
[...]
devDist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'**','!styles/**' // everything but styles/
]
}]
}
},
//
// pass:devDist --> pile the sass; put result in dist/styles/
//
pass: {
[...]
devDist: {
options: {
cssDir: '<%= yeoman.dist %>/styles'
}
}
},
//
// register a 'devDist' task that calls the two tasks above
//
grunt.registerTask('devDist', [
'clean:dist',
'copy:devDist',
'pass:devDist'
]);
Now running grunt devDist
piles my css and puts a fully functional app into my dist folder. Excellent. :)