Created
August 12, 2016 13:13
-
-
Save chrisvasey/d7dfa6f39dab8b647dd13e3129252353 to your computer and use it in GitHub Desktop.
LESS + BrowserSync for static sites
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
npm install -g grunt-cli | |
npm init | |
npm install grunt grunt-contrib-less grunt-contrib-watch jit-grunt grunt-browser-sync --save-dev | |
grunt | |
*/ | |
module.exports = function(grunt) { | |
require('jit-grunt')(grunt); | |
grunt.initConfig({ | |
less: { | |
development: { | |
options: { | |
compress: true, | |
yuicompress: true, | |
optimization: 2 | |
}, | |
files: { | |
"css/main.css": "css/main.less" // destination file and source file | |
} | |
} | |
}, | |
watch: { | |
styles: { | |
files: ['css/**/*.less'], // which files to watch | |
tasks: ['less'], | |
options: { | |
nospawn: true | |
} | |
} | |
}, | |
browserSync: { | |
dev: { | |
bsFiles: { | |
src : [ | |
'css/*.css', | |
'*.html' | |
] | |
}, | |
options: { | |
watchTask: true, | |
server: './' | |
} | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-less'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-browser-sync'); | |
grunt.registerTask('default', ['browserSync','less', 'watch']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment