Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I configure a grint-contrib-less task to compile into a parallel structure?

Currently we are using grunt-contrib-less to handle our LESS file compiling as a Grunt task. The less files are stored in a structure similar to this:

assets/
    styles/
        base.less
        client/
            client.less
            device/
                tablet.less
                phone.less

We have the following for our Grunt config:

less: {
    options: {
        paths: 'assets/',
        yuicompress: false,
        ieCompat: true,
        require: [
            'assets/styles/base.less'
        ]
    },
    src: {
        expand: true,
        cwd: 'assets/',
        src: [
            'styles/**/*.less'
        ],
        ext: '.css',
        dest: 'assets/'
    }
},

Currently this is installing all of the generated css files into the same directory as the original less file it came from. What we'd like to do is have them spit out into an /assets/css/ directory, but with the same relative structure. eg:

assets/
    css/
        base.css
        client/
            client.css
            device/
                tablet.css
                phone.css

Is there a grunt-contrib-less configuration that can accomplish this?

like image 228
ChiperSoft Avatar asked Mar 23 '23 01:03

ChiperSoft


1 Answers

An easier way to do this seems to be:

less: {
    options: {
        paths: 'assets/',
        ieCompat: true,
        require: [
            'assets/styles/base.less'
        ]
    },
    src: {
        expand: true,
        cwd: 'assets/styles/',
        src: [
            '**/*.less'
        ],
        ext: '.css',
        dest: 'assets/css'
    }
},
like image 81
Patricia Garcia Avatar answered Apr 09 '23 20:04

Patricia Garcia