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.

88 lines
2.2 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. inline_import: {
  56. files: {
  57. 'tmp/inline_import.css': ['test/fixtures/input_inline_import.css', 'test/fixtures/inner/input_inline_import.css']
  58. }
  59. }
  60. },
  61. // Unit tests.
  62. nodeunit: {
  63. tests: ['test/*_test.js']
  64. }
  65. });
  66. // Actually load this plugin's task(s).
  67. grunt.loadTasks('tasks');
  68. // These plugins provide necessary tasks.
  69. grunt.loadNpmTasks('grunt-contrib-clean');
  70. grunt.loadNpmTasks('grunt-contrib-jshint');
  71. grunt.loadNpmTasks('grunt-contrib-nodeunit');
  72. grunt.loadNpmTasks('grunt-contrib-internal');
  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', 'cssmin', 'nodeunit']);
  76. // By default, lint and run all tests.
  77. grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
  78. };