From 335ebd65e29bfa3c1ddf0be3dbe8b9087ae75597 Mon Sep 17 00:00:00 2001 From: frank Date: Sun, 25 Aug 2019 13:36:26 +0700 Subject: [PATCH] add autoprefixer grid option --- README.md | 2 +- lib/parse-options.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2a00248..1f0d505 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ and then on the command line, lessc file.less --autoprefix="browsers" ``` -The browsers are a comma seperated list of [browsers as specified with autoprefixer](https://github.com/postcss/autoprefixer#browsers). +The browsers are a comma seperated list of [browsers as specified with autoprefixer](https://github.com/postcss/autoprefixer#browsers). For use autoprefixer grid fallback option, add "grid-on" in browser list. ## Programmatic usage diff --git a/lib/parse-options.js b/lib/parse-options.js index 3f4eb3b..a7621e6 100644 --- a/lib/parse-options.js +++ b/lib/parse-options.js @@ -1,7 +1,10 @@ module.exports = function(options) { if (typeof options === 'string') { - var browsers = options.replace(/\s*,\s*/g, ",").split(","); - options = {browsers: browsers}; + var options = options.replace(/\s*,\s*/g, ",").split(","); + var opt = { + browsers: options.filter(function(el){ return el !== 'grid-on' }), + grid: options.indexOf('grid-on') != -1 ? true : false + }; } - return options; + return opt; };