From 1ddd4b134953a2ac30e60f0675663b48828123dc Mon Sep 17 00:00:00 2001 From: FBiocchetti Date: Tue, 2 May 2017 16:50:24 +0200 Subject: [PATCH 1/2] Added a parameter to exlude specific file(s) --- README.md | 10 +++++++++- bower.json | 2 +- package.json | 2 +- tasks/palettable.js | 43 ++++++++++++++++++++++--------------------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 7fef0ba..93fac58 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,8 @@ In your project's Gruntfile, add a section named `palettable` to the data object grunt.initConfig({ palettable: { options: { - stylesDirectory: 'app/css/' + stylesDirectory: 'app/css/', + excludedFiles: '**/kss.scss' // Optional configuration options go here } } @@ -84,6 +85,12 @@ Default `.` This is the base directory for all of your SASS/SCSS files. Grunt will recurse this directory looking for color variables. +#### excludedFiles +Type: `String`; +Default `/` + +Here you can specify the file(s) you want to exclude from the process. Grunt will ignore those files. + #### outputFilePath Type: `String`; Default `color-palette.html` @@ -196,6 +203,7 @@ In lieu of a formal styleguide, take care to maintain the existing coding style. ## Release History +2017-05-02   v1.1.0   Added a parameter to exclude specific file(s). 2014-07-14   v1.0.0   Initial release. Full SASS and Stylus support. ## License diff --git a/bower.json b/bower.json index 37ce2b8..21779b7 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "palettable", - "version": "1.0.1", + "version": "1.1.0", "description": "Generate HTML color palettes from either SASS, SCSS, or Stylus stylesheets.", "repository": "https://github.com/bvaughn/palettable", "author": { diff --git a/package.json b/package.json index 65dae5e..ac3dde1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "palettable", - "version": "1.0.1", + "version": "1.1.0", "description": "Generate HTML color palettes from either SASS, SCSS, or Stylus stylesheets.", "repository": "https://github.com/bvaughn/palettable", "author": { diff --git a/tasks/palettable.js b/tasks/palettable.js index c0c5906..9fd6202 100644 --- a/tasks/palettable.js +++ b/tasks/palettable.js @@ -25,6 +25,7 @@ module.exports = function(grunt) { openInBrowser: false, outputFilePath: 'color-palette.html', stylesDirectory: '.', + excludedFiles: '/', templateLayoutPath: __dirname + '/../templates/layout.html', templateSwatchPath: __dirname + '/../templates/swatch.html', hoverColorFunction: palettable.defaultHoverColorFunction, @@ -42,31 +43,31 @@ module.exports = function(grunt) { var colors = []; // Gather all $colors in our SCSS files - grunt.file.expand({cwd: options.stylesDirectory}, '**/*.scss'). - forEach(function(file) { - palettable.parseSCSS( - grunt.file.read(options.stylesDirectory + '/' + file), - file, - colors); - }); + grunt.file.expand({cwd: options.stylesDirectory}, '**/*.scss', '!' + options.excludedFiles). + forEach(function(file) { + palettable.parseSCSS( + grunt.file.read(options.stylesDirectory + '/' + file), + file, + colors); + }); // Gather all $colors in our SCSS files - grunt.file.expand({cwd: options.stylesDirectory}, '**/*.sass'). - forEach(function(file) { - palettable.parseSASS( - grunt.file.read(options.stylesDirectory + '/' + file), - file, - colors); - }); + grunt.file.expand({cwd: options.stylesDirectory}, '**/*.sass', '!' + options.excludedFiles). + forEach(function(file) { + palettable.parseSASS( + grunt.file.read(options.stylesDirectory + '/' + file), + file, + colors); + }); // Gather all $colors in our SCSS files - grunt.file.expand({cwd: options.stylesDirectory}, '**/*.styl'). - forEach(function(file) { - palettable.parseStylus( - grunt.file.read(options.stylesDirectory + '/' + file), - file, - colors); - }); + grunt.file.expand({cwd: options.stylesDirectory}, '**/*.styl', '!' + options.excludedFiles). + forEach(function(file) { + palettable.parseStylus( + grunt.file.read(options.stylesDirectory + '/' + file), + file, + colors); + }); // Sort by hue colors = palettable.sortColors(colors, options.colorSortFunction); From 45ac8ec4d2a8c2e3e30715930b61335d3f213e4c Mon Sep 17 00:00:00 2001 From: FBiocchetti Date: Thu, 4 May 2017 16:45:29 +0200 Subject: [PATCH 2/2] Test updated --- Gruntfile.js | 1 + README.md | 2 +- test/fixtures/sanity-check/kss.scss | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/sanity-check/kss.scss diff --git a/Gruntfile.js b/Gruntfile.js index 3b231b7..ecd65d1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -34,6 +34,7 @@ module.exports = function (grunt) { palettable: { options: { outputFilePath: 'tmp/sanity-check.html', + excludedFiles: '**/kss.scss', stylesDirectory: 'test/fixtures/sanity-check', templateLayoutPath: 'test/templates/layout.html', templateSwatchPath: 'test/templates/swatch.html' diff --git a/README.md b/README.md index 93fac58..33d661d 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ This is the base directory for all of your SASS/SCSS files. Grunt will recurse t #### excludedFiles Type: `String`; -Default `/` +Default `null` Here you can specify the file(s) you want to exclude from the process. Grunt will ignore those files. diff --git a/test/fixtures/sanity-check/kss.scss b/test/fixtures/sanity-check/kss.scss new file mode 100644 index 0000000..33eeb38 --- /dev/null +++ b/test/fixtures/sanity-check/kss.scss @@ -0,0 +1,4 @@ +$scss-color-to-ignore-1: #00BBBB; +$scss-color-to-ignore-2: #316635; +$scss-color-to-ignore-3: rgb(64, 63, 153); +$scss-color-to-ignore-4: rgb(170, 163, 18);