-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove support for node 8. Update dependencies. Update eslint config.
- Loading branch information
Showing
18 changed files
with
1,839 additions
and
1,150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ language: node_js | |
node_js: | ||
- '12' | ||
- '10' | ||
- '8' | ||
before_script: | ||
- npm install -g gulp | ||
- gulp lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,34 @@ | ||
'use strict'; | ||
const extend = require('extend'); | ||
const inlineContent = require('./lib/inlineContent'); | ||
|
||
var extend = require('extend'), | ||
inlineContent = require('./lib/inlineContent'); | ||
module.exports = (html, options) => new Promise((resolve, reject) => { | ||
const opt = extend(true, { | ||
extraCss: '', | ||
applyStyleTags: true, | ||
removeStyleTags: true, | ||
applyLinkTags: true, | ||
removeLinkTags: true, | ||
preserveMediaQueries: false, | ||
removeHtmlSelectors: false, | ||
applyWidthAttributes: false, | ||
applyTableAttributes: false, | ||
codeBlocks: { | ||
EJS: { start: '<%', end: '%>' }, | ||
HBS: { start: '{{', end: '}}' } | ||
}, | ||
xmlMode: false, | ||
decodeEntities: false, | ||
lowerCaseTags: true, | ||
lowerCaseAttributeNames: false, | ||
recognizeCDATA: false, | ||
recognizeSelfClosing: false | ||
}, options); | ||
|
||
module.exports = function (html, options) { | ||
return new Promise(function (resolve, reject) { | ||
var opt = extend(true, { | ||
extraCss: '', | ||
applyStyleTags: true, | ||
removeStyleTags: true, | ||
applyLinkTags: true, | ||
removeLinkTags: true, | ||
preserveMediaQueries: false, | ||
removeHtmlSelectors: false, | ||
applyWidthAttributes: false, | ||
applyTableAttributes: false, | ||
codeBlocks: { | ||
EJS: { start: '<%', end: '%>' }, | ||
HBS: { start: '{{', end: '}}' } | ||
}, | ||
xmlMode: false, | ||
decodeEntities: false, | ||
lowerCaseTags: true, | ||
lowerCaseAttributeNames: false, | ||
recognizeCDATA: false, | ||
recognizeSelfClosing: false | ||
}, options); | ||
|
||
inlineContent(String(html), opt) | ||
.then(function (data) { | ||
resolve(data); | ||
}) | ||
.catch(function (err) { | ||
reject(err); | ||
}); | ||
}); | ||
}; | ||
inlineContent(String(html), opt) | ||
.then(data => { | ||
resolve(data); | ||
}) | ||
.catch(err => { | ||
reject(err); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
'use strict'; | ||
|
||
var cssSelector = require('./styleSelector'), | ||
importantSelector = cssSelector('<!important>', [ 2, 0, 0, 0 ]), | ||
property = require('./cssProperty'); | ||
const cssSelector = require('./styleSelector'); | ||
const importantSelector = cssSelector('<!important>', [ 2, 0, 0, 0 ]); | ||
const property = require('./cssProperty'); | ||
|
||
function getProperty(style, name, selector) { | ||
var value = style[name], | ||
sel = style._importants[name] ? importantSelector : selector; | ||
const value = style[name]; | ||
const sel = style._importants[name] ? importantSelector : selector; | ||
|
||
return property(name, value, sel); | ||
} | ||
|
||
// go through the properties | ||
module.exports = function (el, style, selector) { | ||
var i, | ||
l = style.length, | ||
name, | ||
prop, | ||
existing, | ||
winner; | ||
module.exports = ({ styleProps }, style, selector) => { | ||
let i; | ||
const l = style.length; | ||
let name; | ||
let prop; | ||
let existing; | ||
let winner; | ||
|
||
for (i = 0; i < l; i++) { | ||
name = style[i]; | ||
prop = getProperty(style, name, selector); | ||
existing = el.styleProps[name]; | ||
existing = styleProps[name]; | ||
|
||
if (existing) { | ||
winner = existing.compare(prop); | ||
|
||
if (winner === prop) { | ||
el.styleProps[name] = prop; | ||
styleProps[name] = prop; | ||
} | ||
} else { | ||
el.styleProps[name] = prop; | ||
styleProps[name] = prop; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.