Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm's 300,000 packages pre-installed, including grunt-less-themes with all npm packages installed. Try it out:

grunt-less-themes lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("grunt-less-themes/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

grunt-less-themes v0.0.5

Compile multiple themed LESS files to CSS.

grunt-less-themes Build Status

Compile multiple themed LESS files to CSS.

Getting Started

This plugin requires Grunt ~0.4.0

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-less-themes --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-less-themes');

*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.

less-themes task

Run this task with the grunt lessThemes command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Options

This task is an extension of the grunt-contrib-less 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-less-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-less-themes 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: 'theme'

This option is the name of the theme file that is imported into each LESS file for compilation.

Usage Examples

Simple

lessThemes: {
    dev: {
        options: {
            output: 'path/to/output'
        },
        files: {
            'example_{{themeName}}.css': 'simple.less'
        }
    }
}

Complex

lessThemes: {
    dev: {
        options: {
            output: 'path/to/output',
            themeDir: 'path/to/themes'
        },
        files: {
            'core_{{themeName}}.css': ['core/*.less'],
            'common_{{themeName}}.css': ['common/*.less'],
            'components_{{themeName}}.css': ['components/*.less']
        }
    }
}
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free