Skip to content

Instantly share code, notes, and snippets.

@naps62
Last active January 23, 2017 05:47
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save naps62/11101023 to your computer and use it in GitHub Desktop.
Save naps62/11101023 to your computer and use it in GitHub Desktop.
quick Grunt.js setup with Sass + Coffee + Slim
module.exports = (grunt) ->
# configuration
grunt.initConfig
# grunt sass
sass:
compile:
options:
style: 'expanded'
files: [
expand: true
cwd: 'lib/sass'
src: ['**/*.sass', '**/*.scss']
dest: 'css'
ext: '.css'
]
# grunt coffee
coffee:
compile:
expand: true
cwd: 'lib/coffee'
src: ['**/*.coffee']
dest: 'js'
ext: '.js'
options:
bare: true
preserve_dirs: true
# grunt slim
slim:
dist:
files: [{
expand: true
cwd: 'lib/slim'
src: ['**/*.slim']
dest: '.'
ext: '.html'
}]
# grunt watch (or simply grunt)
watch:
html:
files: ['**/*.html']
sass:
files: ['**/*.sass']
tasks: ['sass']
coffee:
files: '<%= coffee.compile.src %>'
tasks: ['coffee']
slim:
files: ['**/*.slim']
tasks: ['slim']
options:
livereload: true
# grunt connect
connect:
server:
options:
open: true
# load plugins
grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-slim'
grunt.loadNpmTasks 'grunt-contrib-connect'
# tasks
grunt.registerTask 'default', ['sass', 'coffee', 'slim', 'connect', 'watch']
{
"name": "PROJECT_NAME",
"description": "PROJECT_DESCRIPTION",
"author": "YOUR_NAME <YOUR@EMAIL.COM>",
"version": "0.1.0",
"devDependencies": {
"coffee-script": "~1.7.1",
"grunt": "~0.4.2",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-connect": "^0.7.1",
"grunt-contrib-sass": "~0.7.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-slim": "^0.1.0"
},
"license": "MIT"
}
@yazinsai
Copy link

yazinsai commented Aug 6, 2015

awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment