I am using grunt-contrib-jade
to compile my jade files. The issue I'm having is that say for example I have the following files:
/views/user.html
/views/user.index.hmtl
/views/user.show.html
These will all be compiled and merged into:
/views/user.html
Why is this happening? I want them to be in separate files like:
/views/user.html
/views/user.index.html
/views/user.show.html
Is there a way to accomplish this?
This is my config:
jade: {
compile: {
options: {
pretty: true,
data: {
debug: false
}
},
files: [{
expand: true,
cwd: '<%= yeoman.client %>',
src: [
'{app,components}/**/*.jade'
],
dest: '.tmp',
ext: '.html'
}]
}
}
You have to use rename
instead of ext
.
This should works:
jade: {
compile: {
options: {
pretty: true,
data: {
debug: false
}
},
files: [{
expand: true,
cwd: '<%= yeoman.client %>',
src: [
'{app,components}/**/*.jade'
],
dest: '.tmp',
rename : function (dest, src) {
var folder = src.substring(0, src.lastIndexOf('/'));
var filename = src.substring(src.lastIndexOf('/'), src.length);
filename = filename.substring(0, filename.lastIndexOf('.'));
return dest + folder + filename + '.min.js';
}
}]
}
}