How to configure Grunt Less Plugin Autoprefixer in Sails.js?

326 views Asked by At

According to the Bootstrap docs, you needs Autoprefixer to compile Bootsrap LESS source files. The grunt-contrib-less compiler supports less-plugin-autoprefix, but I can't get it to work inside Sails.

Here is my modified task/config/less.js file.

module.exports = function(grunt) {

    grunt.config.set('less', {

        dev: {

            options: {
                paths: ["assets/styles/"],
                plugins: [
                    new(require('less-plugin-autoprefix'))({
                        browsers: ["last 2 versions"]
                    })
                ],
            },

            files: [{
                expand: true,
                cwd: 'assets/styles/',
                src: ['importer.less'],
                dest: '.tmp/public/styles/',
                ext: '.css'
            }]
        }
    });

    grunt.loadNpmTasks('less-plugin-autoprefix');
    grunt.loadNpmTasks('grunt-contrib-less');
};

my unmodified task/register/compileAssets file

module.exports = function (grunt) {
    grunt.registerTask('compileAssets', [
        'clean:dev',
        'jst:dev',
        'less:dev',
        'copy:dev',
        'coffee:dev'
    ]);
};

When I

lift sails

no errors are reported, but my css file is not autoprefixed.

0

There are 0 answers