From a3e79d012e064ab6178bd804cbf32ffa430b5d51 Mon Sep 17 00:00:00 2001 From: Lavr Date: Tue, 21 Mar 2017 13:51:53 +0300 Subject: [PATCH] you can rename outputfile with setting filename --- defaults/settings.json | 1 + index.js | 2 +- system/helpers.js | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/defaults/settings.json b/defaults/settings.json index e230bda..db21d2b 100644 --- a/defaults/settings.json +++ b/defaults/settings.json @@ -1,4 +1,5 @@ { + "filename": "smart-grid", "outputStyle": "less", "columns": 12, "offset": "30px", diff --git a/index.js b/index.js index a340024..e57dac7 100644 --- a/index.js +++ b/index.js @@ -30,7 +30,7 @@ module.exports = function(dest, options){ console.log('It`s test mode, because you don`t set destination folder'); } else{ - var buildFile = dest + '/smart-grid.' + res.type; + var buildFile = dest + '/' + options.filename + '.' + res.type; fs.writeFileSync(buildFile, res.grid); console.log('Grid placed into ' + buildFile); } diff --git a/system/helpers.js b/system/helpers.js index e230ed9..1173462 100644 --- a/system/helpers.js +++ b/system/helpers.js @@ -29,8 +29,12 @@ Helpers.prototype.parseUnit = function(str){ res.value = str.substr(0, str.length - 1); res.unit = '%'; } + else if(this.isRem(str)){ + res.value = str.substr(0, str.length - 3); + res.unit = 'rem'; + } else{ - throw new Error('what is "' + str + '" value? We use px and %.'); + throw new Error('what is "' + str + '" value? We use px, % and rem.'); } return res; @@ -44,6 +48,10 @@ Helpers.prototype.isPercentage = function(str){ return str.substr(-1) === '%'; } +Helpers.prototype.isRem = function(str){ + return str.substr(-3) === 'rem'; +} + Helpers.prototype.math = function(a, b, op){ var res = null;