110 lines
2.2 KiB
JavaScript
110 lines
2.2 KiB
JavaScript
|
module.exports = function(grunt) {
|
||
|
|
||
|
var pkg = grunt.file.readJSON('package.json')
|
||
|
|
||
|
// Project configuration.
|
||
|
grunt.initConfig({
|
||
|
sass: {
|
||
|
dist: {
|
||
|
options: {
|
||
|
style: 'compressed'
|
||
|
},
|
||
|
files: [{
|
||
|
expand: true,
|
||
|
cwd: 'assets/sass',
|
||
|
src: ['*.sass'],
|
||
|
dest: 'public/styles',
|
||
|
ext: '.css'
|
||
|
}]
|
||
|
}
|
||
|
},
|
||
|
|
||
|
coffee: {
|
||
|
options: {
|
||
|
sourceMap: true,
|
||
|
style: 'compressed'
|
||
|
},
|
||
|
files: {
|
||
|
expand: true,
|
||
|
flatten: true,
|
||
|
cwd: 'assets/coffee',
|
||
|
src: ['*.coffee'],
|
||
|
dest: 'public/js',
|
||
|
ext: '.js'
|
||
|
}
|
||
|
},
|
||
|
|
||
|
twigRender: {
|
||
|
compile: {
|
||
|
files : [{
|
||
|
data: {
|
||
|
file_root: __dirname + '/public'
|
||
|
},
|
||
|
expand: true,
|
||
|
cwd: 'assets/twig',
|
||
|
src: ['**/*.twig', '!**/_*.twig'],
|
||
|
dest: 'public',
|
||
|
ext: '.html'
|
||
|
}]
|
||
|
},
|
||
|
},
|
||
|
|
||
|
copy: {
|
||
|
main: {
|
||
|
files: [{
|
||
|
expand: true,
|
||
|
cwd: 'assets/static',
|
||
|
src: ['**'],
|
||
|
dest: 'public/',
|
||
|
}]
|
||
|
}
|
||
|
},
|
||
|
|
||
|
watch: {
|
||
|
html: {
|
||
|
files: ['assets/twig/*.twig', 'assets/twig/**/*.twig'],
|
||
|
tasks: ['twigRender'],
|
||
|
options: {
|
||
|
atBegin: true,
|
||
|
spawn: false
|
||
|
}
|
||
|
},
|
||
|
css: {
|
||
|
files: ['assets/sass/*.sass'],
|
||
|
tasks: ['sass'],
|
||
|
options: {
|
||
|
atBegin: true,
|
||
|
spawn: false
|
||
|
}
|
||
|
},
|
||
|
js: {
|
||
|
files: ['assets/coffee/*.coffee'],
|
||
|
tasks: ['coffee'],
|
||
|
options: {
|
||
|
atBegin: true,
|
||
|
spawn: false
|
||
|
}
|
||
|
},
|
||
|
static: {
|
||
|
files: ['assets/static/*/*'],
|
||
|
tasks: ['copy'],
|
||
|
options: {
|
||
|
atBegin: true,
|
||
|
spawn: false
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// Load task plugins
|
||
|
grunt.loadNpmTasks('grunt-twig-render');
|
||
|
grunt.loadNpmTasks('grunt-contrib-sass');
|
||
|
grunt.loadNpmTasks('grunt-contrib-coffee');
|
||
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||
|
|
||
|
// Default task(s).
|
||
|
grunt.registerTask('default', ['twigRender', 'sass', 'coffee', 'copy']);
|
||
|
|
||
|
};
|