0

I have a LESS file (test.less) with the following class:

.bad_class {
   color: #fff
}

I linting and compiling my files with the grunt-recess plugin.

My Grunt options for recess are:

recess: {
    options: {
        noUnderscores: true
    },
    test: {
        files: {
            'assets/css/test.css': [
                'assets/less/test.less'
            ]
        }
    }
}

When I run recess, it doesn't fail.

I tried without setting the noUnderscores option at all - didn't work.

I even tried setting noUnderscores: false, but that didn't work.

What's am I doing wrong?

elanh
  • 1,401
  • 3
  • 19
  • 31

1 Answers1

1

Try this

   recess: {
        build:  {
            src: [ 'assets/less/test.less' ],
            dest: 'assets/css/test.css',
            options: {
                compile: true,
                compress: true,
                noUnderscores: false,
                noIDs: false,
                zeroUnits: false
            }
        }
    }

If above is not working try the below code

recess: {
        build:  {
            src: [ 'assets/less/test.less' ],
            dest: 'assets/css/test.css',
            options: {                    
                compress: false,
                noUnderscores: false,
                noIDs: false,
                zeroUnits: false
            }
        },
       compliefile:{
          src: [ 'assets/less/test.less' ],               
          dest: 'assets/css/test.css',
          options: {
                    compile: true
                   }
           }
}
kds
  • 28,155
  • 9
  • 38
  • 55
  • Thanks, but no success with that either – elanh Oct 25 '13 at 08:10
  • Can you copy the full grunt.js, less file.. ? What is the grunt target trying to execute? – kds Oct 25 '13 at 08:21
  • The .less file is as shown in the question. I'm trying to run grunt recess:test. Does the configuration you posted here work for you? Does it fail if you have a less file with a class name with an underscore, e.g.: .bad_class? – elanh Oct 25 '13 at 08:39
  • Yes, I have setup the same less file and it is working one. can you try the code which I have given and run the target "grunt recess" – kds Oct 25 '13 at 08:53
  • I setup the same thing, but it's still not failing. I set noUnderscores: true because I want it to fail if there is an underscore in the class name. Although, it didn't fail with true or false. What version of grunt-recess are you running. I'm using 0.4.0. – elanh Oct 25 '13 at 09:23
  • I have added a new sample code to the original answer as I cannot paste it here. Can you try that and let me know if that works. You can control by noUnderscores: true – kds Oct 25 '13 at 10:04
  • Yes that helped! It turns out that for some reason, setting compile: true prevents lint from running on the LESS file. But when I removed the compile flag, it started to fail on errors. I ended up using recess only for linting, and then running grunt-contrib-less for compiling as another step. – elanh Oct 25 '13 at 11:07