Skip to:
Content

bbPress.org

Changeset 6100


Ignore:
Timestamp:
09/21/2016 07:27:28 AM (8 years ago)
Author:
netweb
Message:

Build Tools: Switch stylelint Grunt task from grunt postcss:lint to grunt stylelint

This changeset switches the stylelint task from using the grunt-postcss to grunt-stylelint NPM module. This new Grunt module supports stylelint's native formatters and allows for improved task error reporting. This change also splits the CSS and SCSS lint tasks in preparation for a future stylelint-config-wordpress SCSS update.

See also: https://github.com/wikimedia/grunt-stylelint

Props netweb.
See #2924.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r6049 r6100  
    4747
    4848        // PostCSS
    49         autoprefixer = require('autoprefixer'),
    50         stylelint    = require('stylelint'),
    51         reporter     = require('postcss-reporter');
     49        autoprefixer = require('autoprefixer');
    5250
    5351    // Load tasks.
     
    268266                dest: BUILD_DIR,
    269267                src: [ 'includes/admin/styles/*/colors.css' ]
    270             },
    271             lint: {
    272                 options: {
    273                     syntax: require('postcss-scss'),
    274                     processors: [
    275                         stylelint(),
    276                         reporter({
    277                             clearMessages: true,
    278                             throwError: true
    279                             }
    280                         )
    281                     ]
    282                 },
    283                 expand: true,
    284                 cwd: SOURCE_DIR,
    285                 dest: SOURCE_DIR,
    286                 src: [ [ BBP_LTR_CSS ], 'includes/admin/styles/*/colors.scss' ]
    287268            }
    288269        },
     
    323304            }
    324305        },
     306        stylelint: {
     307            css: {
     308                options: {
     309                    configFile: '.stylelintrc',
     310                    format: 'css'
     311                },
     312                expand: true,
     313                cwd: SOURCE_DIR,
     314                src: BBP_LTR_CSS
     315            },
     316            scss: {
     317                options: {
     318                    configFile: '.stylelintrc',
     319                    format: 'scss'
     320                },
     321                expand: true,
     322                cwd: SOURCE_DIR,
     323                src: [ 'includes/admin/styles/*/colors.scss' ]
     324            }
     325        },
    325326        uglify: {
    326327            core: {
     
    393394
    394395    // Build tasks.
    395     grunt.registerTask( 'src',     [ 'checkDependencies', 'jsvalidate:src', 'jshint', 'postcss:lint' ] );
     396    grunt.registerTask( 'src',     [ 'checkDependencies', 'jsvalidate:src', 'jshint', 'stylelint' ] );
    396397    grunt.registerTask( 'commit',  [ 'src', 'checktextdomain' ] );
    397398    grunt.registerTask( 'build',   [ 'commit', 'clean:all', 'copy:files', 'postcss:core', 'colors', 'rtlcss:core', 'cssmin:ltr', 'cssmin:rtl', 'uglify:core', 'jsvalidate:build', 'makepot' ] );
  • trunk/package.json

    r6093 r6100  
    2323    "grunt-rtlcss": "~2.0.1",
    2424    "grunt-sass": "~1.2.0",
     25    "grunt-stylelint": "^0.6.0",
    2526    "grunt-wp-i18n": "~0.5.2",
    2627    "matchdep": "~1.0.1",
    27     "postcss-reporter": "~1.3.3",
    28     "postcss-scss": "~0.1.7",
     28    "postcss-scss": "~0.3.0",
    2929    "stylelint": "^7.2.0"
    3030  },
Note: See TracChangeset for help on using the changeset viewer.