You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.1 KiB

  1. /*
  2. * grunt-contrib-cssmin
  3. * http://gruntjs.com/
  4. *
  5. * Copyright (c) 2012 Tim Branyen, contributors
  6. * Licensed under the MIT license.
  7. */
  8. 'use strict';
  9. module.exports = function(grunt) {
  10. // Project configuration.
  11. grunt.initConfig({
  12. jshint: {
  13. all: [
  14. 'Gruntfile.js',
  15. 'tasks/*.js',
  16. '<%= nodeunit.tests %>'
  17. ],
  18. options: {
  19. jshintrc: '.jshintrc'
  20. }
  21. },
  22. // Before generating any new files, remove any previously-created files.
  23. clean: {
  24. test: ['tmp']
  25. },
  26. // Configuration to be run (and then tested).
  27. cssmin: {
  28. compress: {
  29. files: {
  30. 'tmp/style.css': ['test/fixtures/input_one.css', 'test/fixtures/input_two.css']
  31. }
  32. },
  33. empty: {
  34. files: {
  35. 'tmp/idontexist.css': ['test/fixtures/idontexist.css']
  36. }
  37. },
  38. with_banner: {
  39. options: {
  40. banner: '/* module name - my awesome css banner */'
  41. },
  42. files: {
  43. 'tmp/with-banner.css': ['test/fixtures/input_one.css', 'test/fixtures/input_two.css']
  44. }
  45. },
  46. remove_first_comment: {
  47. options: {
  48. banner: '/* custom banner */',
  49. keepSpecialComments: 0
  50. },
  51. files: {
  52. 'tmp/remove_first_comment.css': ['test/fixtures/input_bannered.css']
  53. }
  54. }
  55. },
  56. // Unit tests.
  57. nodeunit: {
  58. tests: ['test/*_test.js']
  59. }
  60. });
  61. // Actually load this plugin's task(s).
  62. grunt.loadTasks('tasks');
  63. // These plugins provide necessary tasks.
  64. grunt.loadNpmTasks('grunt-contrib-clean');
  65. grunt.loadNpmTasks('grunt-contrib-jshint');
  66. grunt.loadNpmTasks('grunt-contrib-nodeunit');
  67. grunt.loadNpmTasks('grunt-contrib-internal');
  68. // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  69. // plugin's task(s), then test the result.
  70. grunt.registerTask('test', ['clean', 'cssmin', 'nodeunit']);
  71. // By default, lint and run all tests.
  72. grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
  73. };