grunt-sass-themer
v1.1.3
Published
Compile multiple themed SASS files to CSS.
Downloads
4
Maintainers
Readme
grunt-sass-themer
=======================
Compile theme-able SASS files to CSS. Use the same SASS files and only override variables for different themes.
Based on grunt-less-themes
Getting Started
This plugin requires node >=5.4
, node-sass >=3.4.2
, Grunt >=0.4.5
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-sass-themer --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-sass-themer');
*This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade.
sass-themer task
Run this task with the grunt sassThemer
command.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
Options
This task is an extension of the node-sass task. The options from that task are also compatible with this one.
output
Type: String
Default: 'generated'
This option defines the output directory for the grunt-sass-theme
task.
themeDir
Type: String
Default: 'themes'
This option defines the directory where all the themes are hosted
themes
Type: Array
This option provides the grunt-sass-themer
task with the names of each theme. This name is used to in finding the theme and in the generated file.
placeholder
Type: String
Default: '{{theme}}'
This option is the placeholder string used in the output CSS filename. The name of each theme will replace this placeholder.
themeImport
Type: String
Default: '_sassthemer_temp'
This option is the name of the theme file that is imported into each SASS file for compilation. The file is replaced on every iteration of the themes with the current theme in process. If the name is left blank, a '_sassthemer_temp.scss' file will get created at the root level. Make sure the name matches the @import directive in your main scss file or the compilation will fail. The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file.
Usage Examples
Simple
sassThemer: {
dev: {
options: {
output: 'path/to/output'
},
files: {
//destination: source
'example_{{themeName}}.css': 'simple.scss'
}
}
}
Complex
sassThemer: {
dev: {
options: {
output: 'path/to/output',
themeDir: 'path/to/themes'
},
files: {
'core_{{themeName}}.css': ['core/*.scss'],
'common_{{themeName}}.css': ['common/*.scss'],
'components_{{themeName}}.css': ['components/*.scss']
}
}
}