From 97c60fa63f03c84974699e3f6b6dbcc41167b547 Mon Sep 17 00:00:00 2001 From: Mitya Date: Fri, 29 Sep 2017 12:17:39 +0300 Subject: [PATCH] delete old dir --- old/build.js | 91 ---------------------------- old/defaults/settings.json | 55 ----------------- old/index.js | 54 ----------------- old/system/base.js | 81 ------------------------- old/system/column.js | 14 ----- old/system/helpers.js | 76 ----------------------- old/system/media.js | 47 --------------- old/system/mixin.js | 24 -------- old/system/offset.js | 51 ---------------- old/system/patterns/clearfix | 5 -- old/system/patterns/debug | 23 ------- old/system/patterns/minix | 3 - old/system/patterns/reset | 46 -------------- old/system/properties.js | 32 ---------- old/system/replaces.js | 113 ----------------------------------- old/system/size.js | 23 ------- old/system/styles.js | 32 ---------- 17 files changed, 770 deletions(-) delete mode 100644 old/build.js delete mode 100644 old/defaults/settings.json delete mode 100644 old/index.js delete mode 100644 old/system/base.js delete mode 100644 old/system/column.js delete mode 100644 old/system/helpers.js delete mode 100644 old/system/media.js delete mode 100644 old/system/mixin.js delete mode 100644 old/system/offset.js delete mode 100644 old/system/patterns/clearfix delete mode 100644 old/system/patterns/debug delete mode 100644 old/system/patterns/minix delete mode 100644 old/system/patterns/reset delete mode 100644 old/system/properties.js delete mode 100644 old/system/replaces.js delete mode 100644 old/system/size.js delete mode 100644 old/system/styles.js diff --git a/old/build.js b/old/build.js deleted file mode 100644 index 098e413..0000000 --- a/old/build.js +++ /dev/null @@ -1,91 +0,0 @@ -function Build(settings, patterns) { - var resources = {}; - - resources.settings = settings; - resources.helpers = new (require('./system/helpers.js').instance)(); - resources.base = new (require('./system/base.js').instance)(resources); - resources.column = require('./system/column.js'); - resources.size = require('./system/size.js'); - resources.offset = require('./system/offset.js'); - resources.mediaQuery = require('./system/media.js'); - resources.patterns = patterns; - resources.mixin = require('./system/mixin.js'); - resources.replaces = new (require('./system/replaces.js').instance)(resources); - resources.properties = new (require('./system/properties.js').instance)(resources); - resources.styles = new (require('./system/styles.js').instance)(); - - var str = ''; - - str += "{{var}}columns{{=}}" + resources.settings.columns + '{{;}}\n'; - str += "{{var}}offset{{=}}" + resources.settings.offset + '{{;}}\n'; - str += "{{var}}offset_one_side{{=}}({{var}}offset / 2){{;}}\n"; - str += "{{var}}atom{{=}}(100% / {{var}}columns){{;}}\n"; - - str += '\n'; - - for (var name in resources.settings.breakPoints) { - str += "{{var}}break_" + name + '{{=}}' + resources.settings.breakPoints[name].width + "{{;}}\n"; - } - - var reset_mixin = new resources.mixin.create(resources.patterns.mixin, 'reset', '', resources.patterns.reset); - str += '\n' + reset_mixin.render() + '\n'; - - str += "\n" + resources.base.render(); - - var offsets_map = {}; - offsets_map[resources.settings.mixinNames.offset] = 'same'; - offsets_map[resources.settings.mixinNames.offset + '-left'] = 'left'; - offsets_map[resources.settings.mixinNames.offset + '-right'] = 'right'; - offsets_map[resources.settings.mixinNames.offset + '-padding'] = 'same-padding'; - offsets_map[resources.settings.mixinNames.offset + '-left-padding'] = 'left-padding'; - offsets_map[resources.settings.mixinNames.offset + '-right-padding'] = 'right-padding'; - - function generateOneMedia(resources, media, postfix) { - var inner = ''; - - var size = new resources.size.gen(resources, media, resources.settings.mixinNames.size + postfix); - inner += size.render() + "\n"; - - if (resources.settings.oldSizeStyle) { - for (var i = 1; i <= resources.settings.columns; i++) { - var col = new resources.column.gen(resources, resources.settings.mixinNames.column, postfix, i); - inner += col.render() + "\n"; - } - } - - for (var name in offsets_map) { - var offset = new resources.offset.gen(resources, media, name + postfix, offsets_map[name]); - inner += offset.render() + "\n"; - } - - return inner; - } - - var media = new resources.mediaQuery.gen(); - - str += generateOneMedia(resources, media, ''); - str += resources.properties.render(media, ''); - - for (var name in resources.settings.breakPoints) { - var media = new resources.mediaQuery.gen("{{var}}break_" + name); - - str += generateOneMedia(resources, media, '-' + name); - str += resources.properties.render(media, name); - } - - var debug_mixin = new resources.mixin.create(resources.patterns.debug, 'debug', '', resources.patterns.reset); - str += debug_mixin.render() + '\n'; - - var clearfix_mixin = new resources.mixin.create(resources.patterns.mixin, 'clearfix', '', resources.patterns.clearfix); - str += clearfix_mixin.render() + '\n'; - - str = resources.replaces.all(str, resources.settings.outputStyle); - - return { - res: true, - grid: str, - type: resources.settings.outputStyle - }; -} - -module.exports = Build; diff --git a/old/defaults/settings.json b/old/defaults/settings.json deleted file mode 100644 index 2f7a5fe..0000000 --- a/old/defaults/settings.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "filename": "smart-grid", - "outputStyle": "less", - "columns": 12, - "offset": "30px", - "container": { - "maxWidth": "1280px", - "fields": "30px" - }, - "breakPoints": { - "lg": { - "width": "1200px", - "fields": "30px" - }, - "md": { - "width": "992px", - "fields": "15px" - }, - "sm": { - "width": "720px", - "fields": "15px" - }, - "xs": { - "width": "576px", - "fields": "15px" - } - }, - "mixinNames": { - "container": "wrapper", - "row": "row-flex", - "rowFloat": "row-float", - "column": "col", - "size": "size", - "columnFloat": "col-float", - "columnPadding": "col-padding", - "offset": "offset" - }, - "properties": [ - "justify-content", - "align-items", - "align-content", - "align-self", - "order", - "flex", - "flex-grow", - "flex-shrink", - "flex-basis", - "flex-direction", - "flex-wrap", - "flex-flow", - "float" - ], - "tab": " ", - "oldSizeStyle": true -} \ No newline at end of file diff --git a/old/index.js b/old/index.js deleted file mode 100644 index a37bbdc..0000000 --- a/old/index.js +++ /dev/null @@ -1,54 +0,0 @@ -module.exports = function (dest, options) { - try { - var root = __dirname; - var fs = require('fs'); - - var jsonSettings = fs.readFileSync(root + '/defaults/settings.json'); - var defaults = JSON.parse(jsonSettings); - - var innerMerge = { - container: true, - breakPoints: false, - mixinNames: true - }; - - if (typeof options !== "object") { - options = defaults; - } else { - for (var key in defaults) { - if (typeof (options[key]) === "undefined") { - options[key] = defaults[key]; - } - else if (typeof options[key] === "object" && innerMerge[key]) { - for (var k in defaults[key]) { - if (typeof (options[key][k]) === "undefined") { - options[key][k] = defaults[key][k]; - } - } - } - } - } - - var patterns = {}; - patterns.mixin = fs.readFileSync(root + '/system/patterns/minix'); - patterns.clearfix = fs.readFileSync(root + '/system/patterns/clearfix'); - patterns.reset = fs.readFileSync(root + '/system/patterns/reset'); - patterns.debug = fs.readFileSync(root + '/system/patterns/debug'); - - var build = require('./build.js'); - var res = build(options, patterns); - - if (dest === undefined) { - console.log('It`s test mode, because you don`t set destination folder'); - } else { - var buildFile = dest + '/' + options.filename + '.' + res.type; - fs.writeFileSync(buildFile, res.grid); - console.log('Grid placed into ' + buildFile); - } - - console.log('Grid length is ' + res.grid.length + ' :)'); - console.log("Its work! Good day!"); - } catch (err) { - console.log("Oops -> " + err); - } -} \ No newline at end of file diff --git a/old/system/base.js b/old/system/base.js deleted file mode 100644 index 10061e1..0000000 --- a/old/system/base.js +++ /dev/null @@ -1,81 +0,0 @@ -function Base(resources) { - this.resources = resources; - - var offset = this.resources.helpers.parseUnit(this.resources.settings.offset); - - this.content = { - row: { - display: "flex", - 'flex-wrap': "wrap", - 'margin-left': "({{var}}offset_one_side * -1)", - 'margin-right': "({{var}}offset_one_side * -1)" - }, - rowFloat: { - 'margin-left': "({{var}}offset_one_side * -1)", - 'margin-right': "({{var}}offset_one_side * -1)", - '{{call}}clearfix()': null, - }, - column: { - 'box-sizing': "border-box", - 'margin-left': "{{var}}offset_one_side", - 'margin-right': "{{var}}offset_one_side", - 'word-wrap': "break-word" - }, - columnFloat: { - 'float': 'left' - }, - columnPadding: { - 'padding-left': "{{var}}offset_one_side", - 'padding-right': "{{var}}offset_one_side", - 'word-wrap': "break-word" - } - }; -} - -Base.prototype.render = function () { - var out = ""; - - var container = { - 'max-width': this.resources.settings.container.maxWidth, - 'padding-left': this.resources.settings.container.fields, - 'padding-right': this.resources.settings.container.fields, - margin: "0 auto" - }; - - var wrapAndMixinWrap = ''; - - var cont = this.resources.styles.objToStyles(container, 1); - var media = new this.resources.mediaQuery.gen(); - wrapAndMixinWrap += media.wrap(cont); - - for (var name in this.resources.settings.breakPoints) { - var point = this.resources.settings.breakPoints[name]; - var media = new this.resources.mediaQuery.gen("{{var}}break_" + name); - - var containerMedia = { - 'padding-left': point.fields, - 'padding-right': point.fields - }; - - var cont = this.resources.styles.objToStyles(containerMedia); - wrapAndMixinWrap += "\n\n" + media.wrap(cont, 1); - } - - var mixinWrapper = new this.resources.mixin.create(this.resources.patterns.mixin, this.resources.settings.mixinNames.container, '', wrapAndMixinWrap); - out += mixinWrapper.render(this.resources.settings.outputStyle) + '\n'; - - for (var name in this.resources.settings.mixinNames) { - if(this.content[name] !== undefined){ - var selector = this.resources.settings.mixinNames[name]; - var styles = this.resources.styles.objToStyles(this.content[name], 1); - var media = new this.resources.mediaQuery.gen(); - var mixin = new this.resources.mixin.create(this.resources.patterns.mixin, selector, '', media.wrap(styles)); - - out += mixin.render() + '\n'; - } - } - - return out; -} - -module.exports.instance = Base; \ No newline at end of file diff --git a/old/system/column.js b/old/system/column.js deleted file mode 100644 index f0c439e..0000000 --- a/old/system/column.js +++ /dev/null @@ -1,14 +0,0 @@ -function Column(resources, name, postfix, num) { - this.resources = resources; - this.name = name; - this.postfix = postfix; - this.num = num; -} - -Column.prototype.render = function () { - var style = "{{tab}}{{call}}" + this.resources.settings.mixinNames.size + this.postfix + "(" + this.num + ")" + "{{;}}"; - var mixin = new this.resources.mixin.create(this.resources.patterns.mixin, this.name + this.postfix + '-' + this.num, '', style); - return mixin.render(this.resources.settings.outputStyle); -}; - -module.exports.gen = Column; \ No newline at end of file diff --git a/old/system/helpers.js b/old/system/helpers.js deleted file mode 100644 index 1173462..0000000 --- a/old/system/helpers.js +++ /dev/null @@ -1,76 +0,0 @@ -function Helpers(){ - -} - -Helpers.prototype.smartCalc = function(w, o, operation){ - var output = ""; - var width = this.parseUnit(w); - var offset = this.parseUnit(o); - - if(width.unit === offset.unit){ - var value = this.math(width.value, offset.value, operation); - output = value + width.unit; - } - else{ - output = 'calc(' + width.value + width.unit + ' ' + operation + ' {{string-var}}offset{{/string-var}})'; - } - - return output; -}; - -Helpers.prototype.parseUnit = function(str){ - var res = {}; - - if(this.isPixel(str)){ - res.value = str.substr(0, str.length - 2); - res.unit = 'px'; - } - else if(this.isPercentage(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 rem.'); - } - - return res; -} - -Helpers.prototype.isPixel = function(str){ - return str.substr(-2) === 'px'; -} - -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; - - switch(op){ - case '+': - res = +a + b; - break; - case '-': - res = a - b; - break; - case '*': - res = a * b; - break; - case '/': - res = a / b; - break; - } - - return res; -} - -module.exports.instance = Helpers; \ No newline at end of file diff --git a/old/system/media.js b/old/system/media.js deleted file mode 100644 index 96e6d95..0000000 --- a/old/system/media.js +++ /dev/null @@ -1,47 +0,0 @@ -function Media(breakPoint, device, condition) { - this.breakPoint = breakPoint || null; - this.device = device || 'screen'; - this.condition = condition || 'max-width'; -} - -Media.prototype.wrap = function (styles, left) { - var offset = left || 0; - - var start = ''; - var end = ''; - - if(this.breakPoint === null){ - if(styles.lastIndexOf("\n") === styles.length - 1){ - styles = styles.substr(0, styles.length - 1); - } - } - else{ - start = this.left(offset) + "@media " + this.device + " and (" + this.condition + ": " + this.breakPoint + "){{brace}}\n"; - end = this.left(offset) + "{{/brace}}"; - offset++; - } - - var tmp = styles.split("\n"); - - for(var i = 0; i < tmp.length; i++){ - if(tmp[i].length > 0){ - tmp[i] = this.left(offset) + tmp[i]; - } - } - - start += tmp.join("\n"); - start += end; - return start; -} - -Media.prototype.left = function(val){ - var str = ''; - - for(var i = 0; i < val; i++){ - str += '{{tab}}'; - } - - return str; -} - -module.exports.gen = Media; \ No newline at end of file diff --git a/old/system/mixin.js b/old/system/mixin.js deleted file mode 100644 index 5130046..0000000 --- a/old/system/mixin.js +++ /dev/null @@ -1,24 +0,0 @@ -function Mixin(pattern, name, params, content) { - this.pattern = pattern.toString(); - this.name = name; - this.params = params; - this.content = content; - - this.replaces = { - name: this.name, - params: this.params, - content: this.content - }; -} - -Mixin.prototype.render = function(){ - var out = this.pattern; - - for(var key in this.replaces){ - out = out.replace('{{' + key + '}}', this.replaces[key]); - } - - return out; -} - -module.exports.create = Mixin; \ No newline at end of file diff --git a/old/system/offset.js b/old/system/offset.js deleted file mode 100644 index cced819..0000000 --- a/old/system/offset.js +++ /dev/null @@ -1,51 +0,0 @@ -function Offset(resources, media, name, direction) { - this.resources = resources; - this.media = media; - this.name = name; - this.offset = resources.settings.offset; - this.value = (100 / resources.settings.columns) + "%"; - this.properties = []; - - switch(direction){ - case 'left': - this.properties.push('margin-left'); - break; - case 'right': - this.properties.push('margin-right'); - break; - case 'same': - this.properties.push('margin-left'); - this.properties.push('margin-right'); - break; - case 'left-padding': - this.properties.push('padding-left'); - break; - case 'right-padding': - this.properties.push('padding-right'); - break; - case 'same-padding': - this.properties.push('padding-left'); - this.properties.push('padding-right'); - break; - default: - throw new Error('what is "' + direction + '" value? We use [left, right, same, left-padding, right-padding or same-padding] directions in offsets.'); - } -} - -Offset.prototype.render = function () { - var style = '{{var}}value{{=}}{{var}}atom * {{var}}n{{;}}\n'; - - for(var i = 0; i < this.properties.length; i++){ - if(this.resources.helpers.isPercentage(this.offset)){ - style += this.properties[i] + '{{:}}{{var}}value + {{var}}offset_one_side{{;}}\n'; - } - else{ - style += this.properties[i] + '{{:}}{{i}}calc({{string-var}}value{{/string-var}} + {{string-var}}offset_one_side{{/string-var}}){{/i}}{{;}}\n'; - } - } - - var mixin = new this.resources.mixin.create(this.resources.patterns.mixin, this.name, '{{var}}n', this.media.wrap(style, 1)); - return mixin.render(this.resources.settings.outputStyle); -}; - -module.exports.gen = Offset; \ No newline at end of file diff --git a/old/system/patterns/clearfix b/old/system/patterns/clearfix deleted file mode 100644 index f1236bd..0000000 --- a/old/system/patterns/clearfix +++ /dev/null @@ -1,5 +0,0 @@ -{{tab}}&::after{{brace}} -{{tab}}{{tab}}display{{:}}block{{;}} -{{tab}}{{tab}}content{{:}}""{{;}} -{{tab}}{{tab}}clear{{:}}both{{;}} -{{tab}}{{/brace}} \ No newline at end of file diff --git a/old/system/patterns/debug b/old/system/patterns/debug deleted file mode 100644 index 6af9205..0000000 --- a/old/system/patterns/debug +++ /dev/null @@ -1,23 +0,0 @@ -{{before_mixin}}debug({{var}}background, {{var}}outline){{brace}} -{{tab}}height{{:}}100vh{{;}} -{{tab}}position{{:}}fixed{{;}} -{{tab}}width{{:}}100%{{;}} -{{tab}} -{{tab}}> div{{brace}} -{{tab}}{{tab}}height{{:}}inherit{{;}} -{{tab}}{{tab}}{{call}}wrapper(){{;}} -{{tab}}{{tab}} -{{tab}}{{tab}}> div{{brace}} -{{tab}}{{tab}}{{tab}}height{{:}}inherit{{;}} -{{tab}}{{tab}}{{tab}}{{call}}row-flex(){{;}} -{{tab}}{{tab}}{{tab}} -{{tab}}{{tab}}{{tab}}> div{{brace}} -{{tab}}{{tab}}{{tab}}{{tab}}{{call}}col(){{;}} -{{tab}}{{tab}}{{tab}}{{tab}}{{call}}size(1){{;}} -{{tab}}{{tab}}{{tab}}{{tab}}height{{:}}inherit{{;}} -{{tab}}{{tab}}{{tab}}{{tab}}outline{{:}}{{var}}outline{{;}} -{{tab}}{{tab}}{{tab}}{{tab}}background{{:}}{{var}}background{{;}} -{{tab}}{{tab}}{{tab}}{{/brace}} -{{tab}}{{tab}}{{/brace}} -{{tab}}{{/brace}} -{{/brace}} \ No newline at end of file diff --git a/old/system/patterns/minix b/old/system/patterns/minix deleted file mode 100644 index b654eb6..0000000 --- a/old/system/patterns/minix +++ /dev/null @@ -1,3 +0,0 @@ -{{before_mixin}}{{name}}({{params}}){{brace}} -{{content}} -{{/brace}} \ No newline at end of file diff --git a/old/system/patterns/reset b/old/system/patterns/reset deleted file mode 100644 index 3fef709..0000000 --- a/old/system/patterns/reset +++ /dev/null @@ -1,46 +0,0 @@ -{{tab}}body,div,dl,dt,dd,ul,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,input,textarea,p,blockquote,th,td{{brace}} -{{tab}}{{tab}}margin{{:}}0{{;}} -{{tab}}{{tab}}padding{{:}}0{{;}} -{{tab}}{{/brace}} -{{tab}}table{{brace}} -{{tab}}{{tab}}border-collapse{{:}}collapse{{;}} -{{tab}}{{tab}}border-spacing{{:}}0{{;}} -{{tab}}{{/brace}} -{{tab}}fieldset,img,abbr{{brace}} -{{tab}}{{tab}}border{{:}}0{{;}} -{{tab}}{{/brace}} -{{tab}}address,caption,cite,code,dfn,em,strong,th,var{{brace}} -{{tab}}{{tab}}font-style{{:}}normal{{;}} -{{tab}}{{tab}}font-weight{{:}}normal{{;}} -{{tab}}{{/brace}} -{{tab}}ul li{{brace}} -{{tab}}{{tab}}list-style{{:}}none{{;}} -{{tab}}{{/brace}} -{{tab}}caption,th{{brace}} -{{tab}}{{tab}}text-align{{:}}left{{;}} -{{tab}}{{/brace}} -{{tab}}h1,h2,h3,h4,h5,h6{{brace}} -{{tab}}{{tab}}font-size{{:}}100%{{;}} -{{tab}}{{tab}}font-weight{{:}}normal{{;}} -{{tab}}{{/brace}} -{{tab}}sup{{brace}} -{{tab}}{{tab}}vertical-align{{:}}text-top{{;}} -{{tab}}{{/brace}} -{{tab}}sub{{brace}} -{{tab}}{{tab}}vertical-align{{:}}text-bottom{{;}} -{{tab}}{{/brace}} -{{tab}}input,textarea,select{{brace}} -{{tab}}{{tab}}font-family{{:}}inherit{{;}} -{{tab}}{{tab}}font-size{{:}}inherit{{;}} -{{tab}}{{tab}}font-weight{{:}}inherit{{;}} -{{tab}}{{/brace}} -{{tab}}legend{{brace}} -{{tab}}{{tab}}color{{:}}#000{{;}} -{{tab}}{{/brace}} -{{tab}}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,main{{brace}} -{{tab}}{{tab}}display{{:}}block{{;}} -{{tab}}{{/brace}} -{{tab}}img{{brace}} -{{tab}}{{tab}}max-width{{:}}100%{{;}} -{{tab}}{{tab}}height{{:}}auto{{;}} -{{tab}}{{/brace}} \ No newline at end of file diff --git a/old/system/properties.js b/old/system/properties.js deleted file mode 100644 index b6b302a..0000000 --- a/old/system/properties.js +++ /dev/null @@ -1,32 +0,0 @@ -function Properties(resources) { - this.resources = resources; -} - -Properties.prototype.render = function (media, name) { - var out = ''; - var properties = this.resources.settings.properties; - - var nameD = (name === '') ? '' : ('-' + name); - - for (var i = 0; i < properties.length; i++) { - var styles = properties[i] + "{{:}}{{var}}value{{;}}\n"; - var mix = new this.resources.mixin.create(this.resources.patterns.mixin, properties[i] + nameD, '{{var}}value', media.wrap(styles, 1)); - out += mix.render(this.resources.settings.outputStyle) + "\n"; - } - - if(name !== ''){ - var styles = "{{string-var}}name{{/string-var}}{{:}}{{var}}value{{;}}\n"; - var mix = new this.resources.mixin.create(this.resources.patterns.mixin, name, '{{var}}name, {{var}}value', media.wrap(styles, 1)); - out += mix.render(this.resources.settings.outputStyle) + "\n"; - } - - if(name !== ''){ - var styles = "{{block-content-extract}}{{;}}\n"; - var mix = new this.resources.mixin.create(this.resources.patterns.mixin, name + '-block', '{{block-content-var}}', media.wrap(styles, 1)); - out += mix.render(this.resources.settings.outputStyle) + "\n"; - } - - return out; -} - -module.exports.instance = Properties; \ No newline at end of file diff --git a/old/system/replaces.js b/old/system/replaces.js deleted file mode 100644 index c137746..0000000 --- a/old/system/replaces.js +++ /dev/null @@ -1,113 +0,0 @@ -function Replaces(resources) { - this.resources = resources; -} - -Replaces.prototype.all = function(str, style){ - var replaces = { - less: { - '{{var}}': '@', - '{{=}}': ': ', - '{{string-var}}': '@{', - '{{/string-var}}': '}', - '{{i}}': '~"', - '{{/i}}': '"', - '{{before_mixin}}': '.', - '{{call}}': '.', - '{{brace}}': '{', - '{{/brace}}': '}', - '{{:}}': ': ', - '{{;}}': ';', - '{{block-content-var}}': '@content', - '{{block-content-extract}}': '@content()' - }, - scss: { - '{{var}}': '$', - '{{=}}': ': ', - '{{string-var}}': '#{$', - '{{/string-var}}': '}', - '{{i}}': '#{', - '{{/i}}': '}', - '{{before_mixin}}': '@mixin ', - '{{call}}': '@include ', - '{{brace}}': '{', - '{{/brace}}': '}', - '{{:}}': ': ', - '{{;}}': ';', - '{{block-content-var}}': '', - '{{block-content-extract}}': '@content' - }, - styl: { - '{{var}}': '$', - '{{=}}': ' = ', - '{{string-var}}': '{$', - '{{/string-var}}': '}', - '{{i}}': 'iopen', - '{{/i}}': 'iclose', - '{{before_mixin}}': '', - '{{call}}': '', - '{{brace}}': '', - '{{/brace}}': '', - '{{:}}': ' ', - '{{;}}': '', - '{{block-content-var}}': 'content', - '{{block-content-extract}}': '{content}' - }, - sass: { - '{{var}}': '$', - '{{=}}': ': ', - '{{string-var}}': '#{$', - '{{/string-var}}': '}', - '{{i}}': '#{', - '{{/i}}': '}', - '{{before_mixin}}': '=', - '{{call}}': '+', - '{{brace}}': '', - '{{/brace}}': '', - '{{:}}': ': ', - '{{;}}': '', - '{{block-content-var}}': '', - '{{block-content-extract}}': '@content' - } - }; - - if(replaces[style] === undefined){ - throw new Error("smartgrid doesn't have output style \"" + style + "\""); - } - - var active = replaces[style]; - active['{{tab}}'] = this.resources.settings.tab; - - var out = str; - - for(var key in active){ - var tmp = out.split(key); - out = tmp.join(active[key]); - } - - if(style === 'styl'){ - var pattern = new RegExp(replaces.styl['{{i}}'] + '(.+?)' + replaces.styl['{{/i}}'], 'g'); - var pattern_var = new RegExp("\{(.+?)\}", 'g'); - - var ol = replaces.styl['{{i}}'].length; - var cl = replaces.styl['{{/i}}'].length; - - out = out.replace(pattern, function (a){ - var clear = a.substr(ol, a.length - ol - cl); - var one = ''; - var vars = []; - - clear = clear.replace(pattern_var, function(a){ - vars.push(a.substr(1, a.length - 2)); - return '%s'; - }); - - one = '"' + clear + '" % (' + vars.join(' ') + ')'; - - return one; - }); - } - - return out; -} - -module.exports.instance = Replaces; \ No newline at end of file diff --git a/old/system/size.js b/old/system/size.js deleted file mode 100644 index a110e20..0000000 --- a/old/system/size.js +++ /dev/null @@ -1,23 +0,0 @@ -function Size(resources, media, name) { - this.resources = resources; - this.media = media; - this.name = name; - this.offset = resources.settings.offset; - this.value = (100 / resources.settings.columns) + "%"; -} - -Size.prototype.render = function () { - var style = '{{var}}value{{=}}{{var}}atom * {{var}}n{{;}}\n'; - - if(this.resources.helpers.isPercentage(this.offset)){ - style += 'width{{:}}{{var}}value - {{var}}offset{{;}}\n'; - } - else{ - style += 'width{{:}}{{i}}calc({{string-var}}value{{/string-var}} - {{string-var}}offset{{/string-var}}){{/i}}{{;}}\n'; - } - - var mixin = new this.resources.mixin.create(this.resources.patterns.mixin, this.name, '{{var}}n', this.media.wrap(style, 1)); - return mixin.render(this.resources.settings.outputStyle); -}; - -module.exports.gen = Size; \ No newline at end of file diff --git a/old/system/styles.js b/old/system/styles.js deleted file mode 100644 index 12589f1..0000000 --- a/old/system/styles.js +++ /dev/null @@ -1,32 +0,0 @@ -function Styles() { - -} - -Styles.prototype.objToStyles = function (obj, left) { - var styles = ''; - var offset = left || 0; - - for (var propetry in obj) { - styles += this.left(offset) + propetry; - - if (obj[propetry] !== null) { - styles += '{{:}}' + obj[propetry]; - } - - styles += "{{;}}\n"; - } - - return styles; -}; - -Styles.prototype.left = function(val){ - var str = ''; - - for(var i = 0; i < val; i++){ - str += '{{tab}}'; - } - - return str; -} - -module.exports.instance = Styles; \ No newline at end of file