Gruntfile.js in ustyle-1.15.3 vs Gruntfile.js in ustyle-1.16.1

- old
+ new

@@ -1,202 +1,224 @@ -module.exports = function(grunt) { - grunt.loadNpmTasks("grunt-postcss"); - require("load-grunt-tasks")(grunt); - grunt.loadTasks("grunt/tasks"); +module.exports = function (grunt) { + grunt.loadNpmTasks('grunt-postcss') + require('load-grunt-tasks')(grunt) + grunt.loadTasks('grunt/tasks') grunt.initConfig({ shell: { publish: { - command: "bundle exec rake ustyle:publish" + command: 'bundle exec rake ustyle:publish' } }, version: { project: { - src: ["package.json", "lib/ustyle/version.rb"] + src: ['package.json', 'lib/ustyle/version.rb'] } }, postcss: { options: { map: false, processors: [ - require("autoprefixer")({ - browsers: ["last 5 versions", "Firefox ESR", "not Explorer < 9", "> 1%", "Opera > 18"] - }) + require('autoprefixer')({ + browsers: ['last 5 versions', 'Firefox ESR', 'not Explorer < 9', '> 1%', 'Opera > 18'] + }) ] }, - dist: { src: ["docs/**/*.css", "dist/**/*.css"] } + dist: { src: ['docs/**/*.css', 'dist/**/*.css'] } }, watch: { options: { spawn: false }, build: { - files: ["vendor/assets/**/*", "styleguide/**/*", "dist/ustyle.json"], - tasks: ["copy", "sass", "sassdoc", "postcss", "browserSync-inject", "styleguide", "builder"] + files: ['vendor/assets/**/*', 'styleguide/**/*', 'dist/ustyle.json'], + tasks: ['copy', 'sass', 'sassdoc', 'postcss', 'browserSync-inject', 'styleguide', 'builder'] }, scripts: { - files: ["styleguide/**/*.js", "vendor/**/*.js"], - tasks: ["concat"] + files: ['styleguide/**/*.js', 'vendor/**/*.js'], + tasks: ['concat'] } }, svgstore: { options: { - prefix: "icon-" + prefix: 'icon-' }, default: { files: { - "vendor/assets/images/icons.svg": ["vendor/assets/images/icons/*.svg"], - "dist/icons.svg": ["vendor/assets/images/icons/*.svg"], - "styleguide/assets/images/icons.svg": ["vendor/assets/images/icons/*.svg"], - }, - }, + 'vendor/assets/images/icons.svg': ['vendor/assets/images/icons/*.svg'], + 'dist/icons.svg': ['vendor/assets/images/icons/*.svg'], + 'styleguide/assets/images/icons.svg': ['vendor/assets/images/icons/*.svg'] + } + } }, svgmin: { dist: { files: [{ expand: true, - cwd: "vendor/assets/images/icons/", - src: "{,*/}*.svg", - dest: "vendor/assets/images/icons/" + cwd: 'vendor/assets/images/icons/', + src: '{,*/}*.svg', + dest: 'vendor/assets/images/icons/' }] } }, styleguide: { dist: { - src: "vendor/assets/stylesheets/ustyle/**/*.scss", - dir: "styleguide", - output: "dist/ustyle.json", - statsFor: "https://assets0.uswitch.com/s3/uswitch-assets-eu/ustyle/{#tag}/ustyle-latest.css", - tagPlaceholder: "{#tag}", - tagStartVersion: "0.9.9" + src: 'vendor/assets/stylesheets/ustyle/**/*.scss', + dir: 'styleguide', + output: 'dist/ustyle.json', + statsFor: 'https://assets0.uswitch.com/s3/uswitch-assets-eu/ustyle/{#tag}/ustyle-latest.css', + tagPlaceholder: '{#tag}', + tagStartVersion: '0.9.9' } }, builder: { - dist:{ + dist: { files: { - "docs/": "dist/ustyle.json" + 'docs/': 'dist/ustyle.json' } } }, sass: { dist: { options: { - loadPath: ["vendor/assets/stylesheets/ustyle", "styleguide/assets/sass"], - require: "./lib/ustyle.rb", - style: "compressed", - sourcemap: "none", + loadPath: ['vendor/assets/stylesheets/ustyle', 'styleguide/assets/sass'], + require: './lib/ustyle.rb', + style: 'compressed', + sourcemap: 'none', bundleExec: true }, files: { - "dist/ustyle-latest.css": "vendor/assets/stylesheets/ustyle.scss", - "dist/ustyle-content.css": "vendor/assets/stylesheets/ustyle-content.scss", - "docs/css/main.css": "styleguide/assets/sass/main.scss" + 'dist/ustyle-latest.css': 'vendor/assets/stylesheets/ustyle.scss', + 'dist/ustyle-content.css': 'vendor/assets/stylesheets/ustyle-content.scss', + 'docs/css/main.css': 'styleguide/assets/sass/main.scss' } } }, concat: { ustyle: { src: [ - "vendor/assets/javascripts/ustyle/utils.js", - "vendor/assets/javascripts/ustyle/anchor.js", - "vendor/assets/javascripts/ustyle/backdrop.js", - "vendor/assets/javascripts/ustyle/overlay.js", - "vendor/assets/javascripts/ustyle/tabs.js", - "vendor/assets/javascripts/ustyle/classtoggler.js", - "vendor/assets/javascripts/ustyle/radioToggle.js" + 'vendor/assets/javascripts/ustyle/utils.js', + 'vendor/assets/javascripts/ustyle/anchor.js', + 'vendor/assets/javascripts/ustyle/backdrop.js', + 'vendor/assets/javascripts/ustyle/overlay.js', + 'vendor/assets/javascripts/ustyle/tabs.js', + 'vendor/assets/javascripts/ustyle/classtoggler.js', + 'vendor/assets/javascripts/ustyle/radioToggle.js' ], - dest: "dist/ustyle.js" + dest: 'dist/ustyle.js' }, app: { - src: ["styleguide/assets/javascripts/vendor/*.js", "dist/ustyle.js", "styleguide/assets/javascripts/modules/*.js", "styleguide/assets/javascripts/*.js"], - dest: "docs/js/app.js" + src: [ + 'styleguide/assets/javascripts/vendor/*.js', + 'dist/ustyle.js', + 'styleguide/assets/javascripts/modules/*.js', + 'styleguide/assets/javascripts/*.js' + ], + dest: 'docs/js/app.js' } }, uglify: { ustyle: { files: { - "dist/ustyle.min.js": ["dist/ustyle.js"] + 'dist/ustyle.min.js': ['dist/ustyle.js'], + 'docs/js/app.min.js': ['docs/js/app.js'] } } }, copy: { main: { files: [ - {expand: true, flatten: true, src: ["dist/*.css"], dest: "docs/css/"}, - {expand: true, flatten: true, src: ["styleguide/assets/images/**"], dest: "docs/images/"}, - {expand: true, flatten: true, src: ["styleguide/CNAME"], dest: "docs/"}, + {expand: true, flatten: true, src: ['dist/*.css'], dest: 'docs/css/'}, + {expand: true, flatten: true, src: ['styleguide/assets/images/**'], dest: 'docs/images/'}, + {expand: true, flatten: true, src: ['styleguide/CNAME'], dest: 'docs/'} ] } }, sassdoc: { default: { - src: "vendor/assets/stylesheets/ustyle/**/*.scss", + src: 'vendor/assets/stylesheets/ustyle/**/*.scss', options: { - dest: "./docs/sass" + dest: './docs/sass' } } }, scsslint: { allFiles: [ - "./vendor/assets/stylesheets/**/*.scss", - "./styleguide/assets/sass/**/*.scss" + './vendor/assets/stylesheets/**/*.scss', + './styleguide/assets/sass/**/*.scss' ], options: { bundleExec: true, - config: "config/scss-lint.yml", + config: 'config/scss-lint.yml', reporterOutput: null, exclude: [ - "./vendor/assets/stylesheets/ustyle/vendor/*", - "./styleguide/assets/sass/vendor/*" + './vendor/assets/stylesheets/ustyle/vendor/*', + './styleguide/assets/sass/vendor/*' ] } }, - jscs: { - src: [ - "Gruntfile.js", - "vendor/assets/javascripts/**/*.js" - ], + standard: { options: { - config: "config/.jscsrc" + fix: true, + globals: [ + 'google', + '$', + 'cleanWhiteSpace', + 'svg4everybody', + 'hljs', + 'Overlay', + 'ClassToggler', + 'Tabs', + 'RadioToggle', + 'reportData' + ] + }, + ustyle: { + src: [ + './grunt/**/*.js', + './styleguide/**/!(vendor)/*.js', + './vendor/**/*.js', + '*.js' + ] } }, env: { dev: { - NODE_ENV: "development" + NODE_ENV: 'development' }, build: { - NODE_ENV: "production" + NODE_ENV: 'production' } }, buildcontrol: { options: { - dir: "docs/", + dir: 'docs/', commit: true, push: true, - message: "Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%" + message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%' }, pages: { options: { - remote: "git@github.com:uswitch/ustyle.git", - branch: "gh-pages" + remote: 'git@github.com:uswitch/ustyle.git', + branch: 'gh-pages' } } } - }); + }) - grunt.registerTask("lint", ["scsslint", "jscs"]); - grunt.registerTask("icons", ["newer:svgmin", "svgstore"]); + grunt.registerTask('lint', ['scsslint', 'standard']) + grunt.registerTask('icons', ['newer:svgmin', 'svgstore']) - grunt.registerTask("build", ["sass", "sassdoc", "copy", "concat:ustyle", "uglify:ustyle", "concat:app", "lint", "postcss", "styleguide", "builder"]); + grunt.registerTask('build', ['sass', 'sassdoc', 'copy', 'concat:ustyle', 'uglify:ustyle', 'concat:app', 'lint', 'postcss', 'styleguide', 'builder']) - grunt.registerTask("publish", ["env:build", "build", "buildcontrol:pages"]); + grunt.registerTask('publish', ['env:build', 'build', 'buildcontrol:pages']) - grunt.registerTask("publish:version", "Build and publish ustyle version", function(version) { + grunt.registerTask('publish:version', 'Build and publish ustyle version', function (version) { if (version === null) { - grunt.warn("Version must be specified when publishing ustyle"); + grunt.warn('Version must be specified when publishing ustyle') } - grunt.task.run("env:build", "version::" + version, "build", "shell:publish", "buildcontrol:pages"); - }); + grunt.task.run('env:build', 'version::' + version, 'build', 'shell:publish', 'buildcontrol:pages') + }) - grunt.registerTask("default", ["env:dev", "build", "browserSync-init", "watch"]); -}; + grunt.registerTask('default', ['env:dev', 'build', 'browserSync-init', 'watch']) +}