Skip to content

Instantly share code, notes, and snippets.

@bryanmaina
Forked from inkbase/Gruntfile.js
Last active September 6, 2015 12:59
Show Gist options
  • Save bryanmaina/820c661942502337e8bc to your computer and use it in GitHub Desktop.
Save bryanmaina/820c661942502337e8bc to your computer and use it in GitHub Desktop.
A Gruntfile to set up a Sass/Jade project
module.exports = function(grunt) {
// configure the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// copy from the source directory to build
copy: {
build: {
cwd: 'source',
src: [ '**', '!**/*.jade', '!sass', '!sass/*', '!**/*.scss', '!partials', '!partials/*' ],
dest: 'build',
expand: true
},
},
// clean the build directory
clean: {
build: {
src: [ 'build' ]
},
},
watch: {
sass: {
files: [ 'source/sass/*.scss', 'source/sass/*/*.scss' ],
tasks: [ 'sass' ]
},
jade: {
files: 'source/**/*.jade',
tasks: [ 'jade' ]
},
copy: {
files: [ 'source/**', '!source/**/*.scss', '!source/**/*.jade' ],
tasks: [ 'copy' ]
}
},
jade: {
compile: {
options: {
data: {}
},
files: [{
expand: true,
cwd: 'source',
src: [ '**/*.jade' ],
dest: 'build',
ext: '.html'
}]
}
},
sass: {
dist: {
files: [{
expand: true,
cwd: 'source/sass',
src: [ '*.scss' ],
dest: 'build/style',
ext: '.css'
}]
}
},
connect: {
server: {
options: {
port: 4000,
base: 'build',
hostname: '*'
}
}
}
});
// load the tasks
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-connect');
// define the tasks
grunt.registerTask(
'build',
[ 'clean', 'copy', 'jade', 'sass' ]
);
grunt.registerTask(
'default',
['build', 'connect', 'watch']
//['watch']
);
};
{
"name": "ProjectName",
"description": "Just testing out my workflow.",
"version": "0.1.0",
"author": "Jason Landry",
"private": true,
"devDependencies": {
"grunt": "~0.4.x",
"grunt-contrib-sass": "~0.7.x",
"grunt-contrib-watch": "~0.6.x",
"grunt-contrib-jade": "~0.11.x",
"grunt-contrib-connect": "0.7.x",
"grunt-contrib-clean": "0.5.x",
"grunt-contrib-copy": "0.5.x",
"grunt-mkdir": "0.1.x"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment