Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Counterexample
### package.json
{
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-less": "^1.0.0",
"load-grunt-tasks": "^3.1.0"
}
}
### Gruntfile.js
/*!
* SIMPLIFIED FORK of Bootstrap's Gruntfile
* http://getbootstrap.com
* Copyright 2013-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
clean: {
dist: 'dist'
},
less: {
compileCore: {
options: {
strictMath: true
},
src: 'less/bootstrap.less',
dest: 'dist/css/bootstrap.css'
},
compileTheme: {
options: {
strictMath: true
},
src: 'less/theme.less',
dest: 'dist/css/bootstrap-theme.css'
}
}
});
require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
grunt.registerTask('default', ['clean:dist', 'less:compileCore', 'less:compileTheme']);
};
### Setup
1. Copy above files into a new directory (e.g. `foo`)
2. Copy Bootstrap's `less/` directory into the new directory (as e.g. `foo/less/`)
(Bootstrap version: https://github.com/twbs/bootstrap/commit/984204c39e00d267f49c39d100d0ac2aab8dae9c )
3. npm install
4. grunt
###
Output:
$ grunt
Running "clean:dist" (clean) task
>> 0 paths cleaned.
Running "less:compileCore" (less) task
File dist/css/bootstrap.css created
Running "less:compileTheme" (less) task
File dist/css/bootstrap-theme.css created
Done, without errors.
### Key versions from `npm ls`
├─┬ grunt-contrib-less@1.0.0
[...]
│ ├─┬ less@2.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment