From 7ac4e811b4b2146e72bc17ae792b0e86898da73d Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Sat, 19 Aug 2017 20:09:31 +0000 Subject: [PATCH] Build/Test Tools: Add banner to minified CSS files Patches occasionally come in on generated files. We should be kind to new contributors and give them a hint that these files are auto generated. Props drewapicture, samuelsidler, netweb, valendesigns, kpdesign, nacin, jorbin Fixes #30666 git-svn-id: https://develop.svn.wordpress.org/trunk@41271 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 16 ++++++++++++++++ package.json | 1 + 2 files changed, 17 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 2c213492a8..d977f7eb9c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,7 @@ module.exports = function(grunt) { fs = require( 'fs' ), SOURCE_DIR = 'src/', BUILD_DIR = 'build/', + BANNER_TEXT = '/*! This file is auto-generated */', autoprefixer = require('autoprefixer'), mediaConfig = {}, mediaBuilds = ['audiovideo', 'grid', 'models', 'views']; @@ -59,6 +60,20 @@ module.exports = function(grunt) { ] } }, + usebanner: { + options: { + position: 'top', + banner: BANNER_TEXT, + linebreak: true, + }, + files: { + src: [ + BUILD_DIR + 'wp-admin/css/*.min.css', + BUILD_DIR + 'wp-includes/css/*.min.css', + BUILD_DIR + 'wp-admin/css/colors/*/*.css', + ] + } + }, clean: { all: [BUILD_DIR], dynamic: { @@ -919,6 +934,7 @@ module.exports = function(grunt) { 'concat:emoji', 'includes:emoji', 'includes:embed', + 'usebanner', 'jsvalidate:build' ] ); diff --git a/package.json b/package.json index 0fda642c49..8ffb450645 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "devDependencies": { "autoprefixer": "^6.5.1", "grunt": "~0.4.5", + "grunt-banner": "^0.6.0", "grunt-browserify": "~5.0.0", "grunt-contrib-clean": "~1.0.0", "grunt-contrib-compress": "~1.3.0",