Create a nice formatted LESS variables-file by collecting variables defined in other LESS-files (modules/components).
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-lessvarfile --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-lessvarfile');
In your project's Gruntfile, add a section named lessvarfile
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
lessvarfile: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
Type: Int
Default value: 40
Type: Object
Default value:
{
'c': 'Colors',
's': 'Spacing',
't': 'Typo'
}
Type: String
Default value: "--"
Type: String
Default value: "oc__"
Type: Boolean
Default value: true
Type: Array
Default value: []
grunt.initConfig({
lessvarfile: {
options: {},
files: {
'your-framework/variables.less': 'your-framework/modules/**/*.less'
}
},
})
grunt.initConfig({
lessvarfile: {
options: {
sectionDelimiter: '__',
alignAt: 1,
sectionsmap: {
'c': 'My Crazy Colors',
's': 'My Spacing',
't': 'My Typo'
},
includeAllComponents: false,
optionalComponentIdentifier: 'component__',
optionalComponentsList: ['component__some-component.less']
},
files: {
'your-framework/variables.less': 'your-framework/modules/**/*.less'
},
},
})
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
- Initial Release
- Removed "walk" dependency
- Added delimiter option
- Renamed Git repository
- Added some options to mark specific files (components) as optional
- Bugfixes
- Bugfixes