Skip to content

Instantly share code, notes, and snippets.

@hozefaj
Created December 9, 2015 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hozefaj/a972f7b9a5b2813bc25a to your computer and use it in GitHub Desktop.
Save hozefaj/a972f7b9a5b2813bc25a to your computer and use it in GitHub Desktop.
grunt task to compile base css

Usage

Installing grunt & other dependency npm install -g grunt-cli

Create a folder and place the Gruntfile.js & package.json in it. run npm install to get all the dependencies

Before you run the grunt task, modify the dir value to fit your folder structure

To run grunt, grunt

'use strict'
module.exports = function(grunt) {
// load all grunt tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
var dir = '/Users/hjodiawalla/Desktop/MPPContentDevelopment/MPPContent/ContentRoot/resources/',
computation = dir + 'css/base-mpp.css';
grunt.initConfig({
// basic setting and info about plugins
pkg: grunt.file.readJSON('package.json'),
// set plusgins
watch: {
files: [dir + 'less/jquery-ui.less',
dir + 'less/base-ar.less',
dir + 'less/pp-base.less',
dir + 'less/base.header.less',
dir + 'less/base.footer.less',
dir + 'less/moving.background.less',
dir + 'less/fixed.top.less',
dir + 'less/floating.bar.less',
dir + 'less/carousel.less',
dir + 'less/icons_fonts.less',
dir + 'less/components/campaign-fonts.less',
dir + 'less/base.partials.less',
dir + 'less/base_rtl.less',
dir + 'less/skip-to.less'],
tasks: ['less']
},
less: {
development: {
options: {
compress: true,
paths: [dir + 'css/']
},
files: {
computation : dir + 'less/base-mpp.less'
}
}
}
});
grunt.registerTask('default', ['watch']);
};
{
"name": "mpp",
"version": "0.1.0",
"description": "grunt tasks to complie LESS2CSS",
"main": "index.js",
"keywords": [
"grunt",
"less",
"css"
],
"author": "hjodiawalla",
"license": "MIT",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-less": "^1.1.0",
"grunt-contrib-watch": "^0.6.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment