preact-highlight
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -86,4 +86,4 @@ | ||
}, | ||
version: '1.1.1', | ||
version: '1.1.2', | ||
}; | ||
@@ -13,3 +13,3 @@ 'use strict'; | ||
function themeManger(theme) { | ||
if (!THEME[theme] || !isBrowser) return; | ||
if (!theme || !isBrowser) return; | ||
var doc = document; | ||
@@ -19,3 +19,3 @@ var headDoc = doc.head; | ||
var link = doc.createElement('link'); | ||
var url = utils.cdn(version, THEME[theme]); | ||
var url = utils.cdn(version, theme); | ||
link.setAttribute('href', url); | ||
@@ -22,0 +22,0 @@ link.setAttribute('rel', 'stylesheet'); |
@@ -19,5 +19,5 @@ 'use strict'; | ||
function wrapTheme(theme, style) { | ||
function wrapTheme(styleName, style) { | ||
return ` | ||
.${theme} { | ||
.${styleName} { | ||
${style} | ||
@@ -39,11 +39,11 @@ } | ||
function generateTheme(theme, filePath, targetPath) { | ||
function generateTheme(styleName, filePath, targetPath) { | ||
return new Promise((res, rej) => { | ||
try { | ||
const style = fs.readFileSync(filePath, 'utf8'); | ||
stylus(wrapTheme(theme, style)) | ||
stylus(wrapTheme(styleName, style)) | ||
.set('filename', 'nesting.css') | ||
.render(function(err, css) { | ||
fs.writeFileSync(targetPath, css); | ||
res(theme); | ||
res(styleName); | ||
}); | ||
@@ -83,4 +83,4 @@ } catch (error) { | ||
}); | ||
const queue = normalizeName.map(({ theme, filePath, targetPath }) => { | ||
return generateTheme(theme, filePath, targetPath); | ||
const queue = normalizeName.map(({ styleName, filePath, targetPath }) => { | ||
return generateTheme(styleName, filePath, targetPath); | ||
}); | ||
@@ -87,0 +87,0 @@ queue.push(putConfig(normalizeName)); |
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="1.1.2"></a> | ||
## [1.1.2](https://github.com/jasonChen1982/preact-highlight/compare/v1.1.1...v1.1.2) (2017-06-23) | ||
<a name="1.1.1"></a> | ||
@@ -7,0 +12,0 @@ ## [1.1.1](https://github.com/jasonChen1982/preact-highlight/compare/v1.1.0...v1.1.1) (2017-06-23) |
{ | ||
"name": "preact-highlight", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "a syntax highlight component for preact", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -9,3 +9,3 @@ 'use strict'; | ||
function themeManger(theme) { | ||
if (!THEME[theme] || !isBrowser) return; | ||
if (!theme || !isBrowser) return; | ||
const doc = document; | ||
@@ -15,3 +15,3 @@ const headDoc = doc.head; | ||
const link = doc.createElement('link'); | ||
const url = utils.cdn(version, THEME[theme]); | ||
const url = utils.cdn(version, theme); | ||
link.setAttribute('href', url); | ||
@@ -18,0 +18,0 @@ link.setAttribute('rel', 'stylesheet'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
134899