0

I'm trying to output multiple less files under less folders to build/css folder

here is the code i'm having where i have to specify individual files and its working fine

less: {
        build: {
            options: {
                yuicompress: true,
                paths: ['public/less']
            },
            files: {
                '.build/css/app1.css': 'public/less/app1.less',
                '.build/css/app2.css': 'public/less/app2.less'
            }
        }
    }

I try to make it more generic and tried this but not working

less: {
        build: {
            options: {
                yuicompress: true,
                paths: ['public/less']
            },
            files: {
                  expand: true,
                  cwd: 'public/css',
                  src: '*.less',
                  dest: '.build/css',
                  ext: '*.css'
            }
        }
    }

This is my grunt versions

grunt-cli v0.1.9
grunt v0.4.2

Is there anything missing to any config need to be added?

2 Answers 2

0

I think there is typo in cwd and src should be an array instead of a string and ext has been changed as well, also dest is incorrect.

files: {
    expand: true,
    cwd: 'public/less',
    src: '[**/*.less]',
    dest: 'build/css',
    ext: '.css'
}
Sign up to request clarification or add additional context in comments.

3 Comments

This is not working what does src: '[*/.less]' means?
I'm getting warning like this. Running "less:build" (less) task Warning: Object true has no method 'indexOf' Use --force to continue.
I wrapped like files : [{....}] and the warning was gone and new css folder is created but no css files created
0

This one worked for me, my build folder name is ".build"

files: [{
                expand: true,
                cwd: 'public/less/',
                src: '**/*.less',
                dest: '.build/css',
                ext: '.css'
}]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.