Skip to content

Commit

Permalink
v2.3.20
Browse files Browse the repository at this point in the history
Added comments and minor formating to parsers.
Deleted plugins directory.
  • Loading branch information
amarcruz committed Jan 8, 2016
1 parent ac862fa commit 9942c56
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 81 deletions.
10 changes: 3 additions & 7 deletions dist/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ var parsers = (function () {
},
stylus: function (tag, css, opts, url) {
var
xopts = extend({filename: url}, opts),
stylus = _req('stylus'),
optx = extend({filename: url}, opts),
nib = _req('nib')

/* istanbul ignore next: can't run both */
return nib ?
stylus(css, optx).use(nib()).import('nib').render() : stylus.render(css, optx)
stylus(css, xopts).use(nib()).import('nib').render() : stylus.render(css, xopts)
}
}

Expand All @@ -141,11 +141,7 @@ var parsers = (function () {
}, opts)).code
},
babel: function (js, opts, url) {
return _req('babel').transform(js,
extend({
filename: url
}, opts)
).code
return _req('babel').transform(js, extend({filename: url}, opts)).code
},
coffee: function (js, opts) {
return _req('coffee').compile(js, extend({bare: true}, opts))
Expand Down
10 changes: 3 additions & 7 deletions dist/es6.compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ var parsers = (function () {
},
stylus: function (tag, css, opts, url) {
var
xopts = extend({filename: url}, opts),
stylus = _req('stylus'),
optx = extend({filename: url}, opts),
nib = _req('nib')

/* istanbul ignore next: can't run both */
return nib ?
stylus(css, optx).use(nib()).import('nib').render() : stylus.render(css, optx)
stylus(css, xopts).use(nib()).import('nib').render() : stylus.render(css, xopts)
}
}

Expand All @@ -113,11 +113,7 @@ var parsers = (function () {
}, opts)).code
},
babel: function (js, opts, url) {
return _req('babel').transform(js,
extend({
filename: url
}, opts)
).code
return _req('babel').transform(js, extend({filename: url}, opts)).code
},
coffee: function (js, opts) {
return _req('coffee').compile(js, extend({bare: true}, opts))
Expand Down
10 changes: 3 additions & 7 deletions dist/riot.compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ var parsers = (function () {
},
stylus: function (tag, css, opts, url) {
var
xopts = extend({filename: url}, opts),
stylus = _req('stylus'),
optx = extend({filename: url}, opts),
nib = _req('nib')

/* istanbul ignore next: can't run both */
return nib ?
stylus(css, optx).use(nib()).import('nib').render() : stylus.render(css, optx)
stylus(css, xopts).use(nib()).import('nib').render() : stylus.render(css, xopts)
}
}

Expand All @@ -107,11 +107,7 @@ var parsers = (function () {
}, opts)).code
},
babel: function (js, opts, url) {
return _req('babel').transform(js,
extend({
filename: url
}, opts)
).code
return _req('babel').transform(js, extend({filename: url}, opts)).code
},
coffee: function (js, opts) {
return _req('coffee').compile(js, extend({bare: true}, opts))
Expand Down
22 changes: 12 additions & 10 deletions lib/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,21 @@ var parsers = (function () {
return parser
}

// Returns a parser instance, null if the parser is not found.
// Public through the parsers._get function.
/**
* Returns a parser instance by its name, require the module if necessary.
* Public through the `parsers._req` function.
*
* @param {string} name - The parser's name, as registered in the parsers object
* @param {string} [req] - To be used by require(). Defaults to parser's name
* @returns {Function} - The parser instance, null if the parser is not found
*/
function _req (name, req) {
return name in _mods ? _mods[name] : _try(name, req)
}

/**
* Merge two javascript object extending the properties of the first one with
* the second
* the second.
*
* @param {object} obj - source object
* @param {object} props - extra properties
Expand Down Expand Up @@ -173,13 +179,13 @@ var parsers = (function () {
},
stylus: function (tag, css, opts, url) {
var
xopts = extend({filename: url}, opts),
stylus = _req('stylus'),
optx = extend({filename: url}, opts),
nib = _req('nib') // optional nib support

/* istanbul ignore next: can't run both */
return nib ?
stylus(css, optx).use(nib()).import('nib').render() : stylus.render(css, optx)
stylus(css, xopts).use(nib()).import('nib').render() : stylus.render(css, xopts)
}
}

Expand All @@ -196,11 +202,7 @@ var parsers = (function () {
}, opts)).code
},
babel: function (js, opts, url) {
return _req('babel').transform(js,
extend({
filename: url
}, opts)
).code
return _req('babel').transform(js, extend({filename: url}, opts)).code
},
coffee: function (js, opts) {
return _req('coffee').compile(js, extend({bare: true}, opts))
Expand Down
18 changes: 0 additions & 18 deletions lib/plugins/_utils.js

This file was deleted.

16 changes: 0 additions & 16 deletions lib/plugins/sass.js

This file was deleted.

16 changes: 0 additions & 16 deletions lib/plugins/scss.js

This file was deleted.

0 comments on commit 9942c56

Please sign in to comment.