[484] | 1 | /* |
---|
| 2 | * grunt-contrib-less |
---|
| 3 | * http://gruntjs.com/ |
---|
| 4 | * |
---|
| 5 | * Copyright (c) 2013 Tyler Kellen, contributors |
---|
| 6 | * Licensed under the MIT license. |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | 'use strict'; |
---|
| 10 | |
---|
| 11 | module.exports = function(grunt) { |
---|
| 12 | |
---|
| 13 | // Project configuration. |
---|
| 14 | grunt.initConfig({ |
---|
| 15 | jshint: { |
---|
| 16 | all: [ |
---|
| 17 | 'Gruntfile.js', |
---|
| 18 | 'tasks/*.js', |
---|
| 19 | '<%= nodeunit.tests %>' |
---|
| 20 | ], |
---|
| 21 | options: { |
---|
| 22 | jshintrc: '.jshintrc' |
---|
| 23 | } |
---|
| 24 | }, |
---|
| 25 | |
---|
| 26 | // Before generating any new files, remove any previously-created files. |
---|
| 27 | clean: { |
---|
| 28 | tests: ['tmp'] |
---|
| 29 | }, |
---|
| 30 | |
---|
| 31 | // Configuration to be run (and then tested). |
---|
| 32 | less: { |
---|
| 33 | compile: { |
---|
| 34 | options: { |
---|
| 35 | paths: ['test/fixtures/include'] |
---|
| 36 | }, |
---|
| 37 | files: { |
---|
| 38 | 'tmp/less.css': ['test/fixtures/style.less'], |
---|
| 39 | 'tmp/concat.css': ['test/fixtures/style.less', 'test/fixtures/style2.less', 'test/fixtures/style3.less'] |
---|
| 40 | } |
---|
| 41 | }, |
---|
| 42 | compress: { |
---|
| 43 | options: { |
---|
| 44 | paths: ['test/fixtures/include'], |
---|
| 45 | compress: true |
---|
| 46 | }, |
---|
| 47 | files: { |
---|
| 48 | 'tmp/compress.css': ['test/fixtures/style.less'] |
---|
| 49 | } |
---|
| 50 | }, |
---|
| 51 | nopaths: { |
---|
| 52 | files: { |
---|
| 53 | 'tmp/nopaths.css': ['test/fixtures/nopaths.less'] |
---|
| 54 | } |
---|
| 55 | }, |
---|
| 56 | yuicompress: { |
---|
| 57 | options: { |
---|
| 58 | paths: ['test/fixtures/include'], |
---|
| 59 | yuicompress: true |
---|
| 60 | }, |
---|
| 61 | files: { |
---|
| 62 | 'tmp/yuicompress.css': ['test/fixtures/style.less'] |
---|
| 63 | } |
---|
| 64 | }, |
---|
| 65 | ieCompatTrue: { |
---|
| 66 | options: { |
---|
| 67 | paths: ['test/fixtures/include'], |
---|
| 68 | ieCompat: true |
---|
| 69 | }, |
---|
| 70 | files: { |
---|
| 71 | 'tmp/ieCompatTrue.css': ['test/fixtures/ieCompat.less'] |
---|
| 72 | } |
---|
| 73 | }, |
---|
| 74 | ieCompatFalse: { |
---|
| 75 | options: { |
---|
| 76 | paths: ['test/fixtures/include'], |
---|
| 77 | ieCompat: false |
---|
| 78 | }, |
---|
| 79 | files: { |
---|
| 80 | 'tmp/ieCompatFalse.css': ['test/fixtures/ieCompat.less'] |
---|
| 81 | } |
---|
| 82 | }, |
---|
| 83 | nofiles: { |
---|
| 84 | }, |
---|
| 85 | nomatchedfiles: { |
---|
| 86 | files: { "tmp/nomatchedfiles.css" : 'test/nonexistent/*.less' } |
---|
| 87 | }, |
---|
| 88 | compressReport: { |
---|
| 89 | options: { |
---|
| 90 | paths: ['test/fixtures/include'], |
---|
| 91 | compress: true, |
---|
| 92 | report: 'min' |
---|
| 93 | }, |
---|
| 94 | files: { |
---|
| 95 | 'tmp/compressReport.css': ['test/fixtures/style.less', 'test/fixtures/style2.less'] |
---|
| 96 | } |
---|
| 97 | }, |
---|
| 98 | yuicompressReport: { |
---|
| 99 | options: { |
---|
| 100 | paths: ['test/fixtures/include'], |
---|
| 101 | yuicompress: true, |
---|
| 102 | report: 'gzip' |
---|
| 103 | }, |
---|
| 104 | files: { |
---|
| 105 | 'tmp/yuicompressReport.css': ['test/fixtures/style.less', 'test/fixtures/style2.less', 'test/fixtures/style3.less'] |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | }, |
---|
| 109 | |
---|
| 110 | // Unit tests. |
---|
| 111 | nodeunit: { |
---|
| 112 | tests: ['test/*_test.js'] |
---|
| 113 | } |
---|
| 114 | }); |
---|
| 115 | |
---|
| 116 | // Actually load this plugin's task(s). |
---|
| 117 | grunt.loadTasks('tasks'); |
---|
| 118 | |
---|
| 119 | // These plugins provide necessary tasks. |
---|
| 120 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
| 121 | grunt.loadNpmTasks('grunt-contrib-clean'); |
---|
| 122 | grunt.loadNpmTasks('grunt-contrib-nodeunit'); |
---|
| 123 | grunt.loadNpmTasks('grunt-contrib-internal'); |
---|
| 124 | |
---|
| 125 | // Whenever the "test" task is run, first clean the "tmp" dir, then run this |
---|
| 126 | // plugin's task(s), then test the result. |
---|
| 127 | grunt.registerTask('test', ['clean', 'less', 'nodeunit']); |
---|
| 128 | |
---|
| 129 | // By default, lint and run all tests. |
---|
| 130 | grunt.registerTask('default', ['jshint', 'test', 'build-contrib']); |
---|
| 131 | |
---|
| 132 | }; |
---|