|
| 1 | +/* |
| 2 | + * grunt-purifycss |
| 3 | + * https://github.com/purifycss/grunt-purify-css |
| 4 | + * |
| 5 | + * Copyright (c) 2015 Phoebe Li, Matthew Rourke, Kenny Tran |
| 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 | + purifycss: { |
| 33 | + default_options: { |
| 34 | + options: { |
| 35 | + }, |
| 36 | + files: { |
| 37 | + 'tmp/default_options': ['test/fixtures/testing', 'test/fixtures/123'] |
| 38 | + } |
| 39 | + }, |
| 40 | + custom_options: { |
| 41 | + options: { |
| 42 | + separator: ': ', |
| 43 | + punctuation: ' !!!' |
| 44 | + }, |
| 45 | + files: { |
| 46 | + 'tmp/custom_options': ['test/fixtures/testing', 'test/fixtures/123'] |
| 47 | + }, |
| 48 | + }, |
| 49 | + test: { |
| 50 | + |
| 51 | + src: ['test/fixtures/*.html'], |
| 52 | + css: ['test/fixtures/styles.css'], |
| 53 | + dest: 'tmp/purestyles.css', |
| 54 | + hello: 'hello world' |
| 55 | + } |
| 56 | + }, |
| 57 | + |
| 58 | + // Unit tests.grunt |
| 59 | + nodeunit: { |
| 60 | + tests: ['test/*_test.js'] |
| 61 | + } |
| 62 | + |
| 63 | + }); |
| 64 | + |
| 65 | + // Actually load this plugin's task(s). |
| 66 | + grunt.loadTasks('tasks'); |
| 67 | + |
| 68 | + // These plugins provide necessary tasks. |
| 69 | + grunt.loadNpmTasks('grunt-contrib-jshint'); |
| 70 | + grunt.loadNpmTasks('grunt-contrib-clean'); |
| 71 | + grunt.loadNpmTasks('grunt-contrib-nodeunit'); |
| 72 | + |
| 73 | + // Whenever the "test" task is run, first clean the "tmp" dir, then run this |
| 74 | + // plugin's task(s), then test the result. |
| 75 | + grunt.registerTask('test', ['clean', 'purifycss', 'nodeunit']); |
| 76 | + |
| 77 | + // By default, lint and run all tests. |
| 78 | + grunt.registerTask('default', ['purifycss:test']); |
| 79 | + |
| 80 | +}; |
0 commit comments