Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/syntaxHighlight.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var fs = require('fs');
var hl = require('highlight.js');
var nano = require('cssnano');
var csso = require('csso');

exports.highlight = function (css) {
return hl.highlight('css', css).value;
Expand All @@ -11,9 +11,9 @@ exports.execute = function (params) {
var tmplStyle = params.tmplStyle;
var codeStyle = fs.readFileSync(params.stylePath, 'utf-8');
return Promise.all([
nano.process(src),
nano.process(tmplStyle),
nano.process(codeStyle)
csso.minify(src),
csso.minify(tmplStyle),
csso.minify(codeStyle)
]);
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"css-annotation": "^0.6.0",
"css-annotation-block": "^0.1.0",
"cssnano": "^3.0.1",
"csso": "^2.2.0",
"ejs": "^2.3.1",
"highlight.js": "^8.5.0",
"is-color": "^0.2.0",
Expand Down
3 changes: 2 additions & 1 deletion test/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
<meta charset="UTF-8">
<title>Style Guide</title>
<style>.hljs{display:block;overflow-x:auto;padding:.5em;color:#333;background:#f8f8f8;-webkit-text-size-adjust:none}.diff .hljs-header,.hljs-comment{color:#998;font-style:italic}.css .rule .hljs-keyword,.hljs-keyword,.hljs-request,.hljs-status,.hljs-subst,.hljs-winutils,.nginx .hljs-title{color:#333;font-weight:700}.hljs-hexcolor,.hljs-number,.ruby .hljs-constant{color:teal}.hljs-doctag,.hljs-string,.hljs-tag .hljs-value,.tex .hljs-formula{color:#d14}.hljs-id,.hljs-title,.scss .hljs-preprocessor{color:#900;font-weight:700}.hljs-list .hljs-keyword,.hljs-subst{font-weight:400}.hljs-class .hljs-title,.hljs-type,.tex .hljs-command,.vhdl .hljs-literal{color:#458;font-weight:700}.django .hljs-tag .hljs-keyword,.hljs-rule .hljs-property,.hljs-tag,.hljs-tag .hljs-title{color:navy;font-weight:400}.hljs-attribute,.hljs-name,.hljs-variable,.lisp .hljs-body{color:teal}.hljs-regexp{color:#009926}.clojure .hljs-keyword,.hljs-prompt,.hljs-symbol,.lisp .hljs-keyword,.ruby .hljs-symbol .hljs-string,.scheme .hljs-keyword,.tex .hljs-special{color:#990073}.hljs-built_in{color:#0086b3}.hljs-cdata,.hljs-doctype,.hljs-pi,.hljs-pragma,.hljs-preprocessor,.hljs-shebang{color:#999;font-weight:700}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.diff .hljs-change{background:#0086b3}.hljs-chunk{color:#aaa}/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{box-sizing:border-box}*,:after,:before,input[type=search]{box-sizing:inherit}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,p,pre{margin:0}button{background:transparent;border:0;padding:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}fieldset{border:0;margin:0;padding:0}iframe{border:0}ol,ul{list-style:none;margin:0;padding:0}[tabindex="-1"]:focus{outline:none!important}html.psg-theme{font-size:62.5%}body{margin:0}body,html{height:100%;overflow-y:hidden}h1[id],h2[id],h3[id],h4[id],h5[id],h6[id]{margin:2rem 0 1rem;font-weight:400;line-height:1.6;color:#444}h1[id]{font-size:2.8rem}h2[id]{font-size:2.4rem}h3[id]{font-size:2rem}h4[id],h5[id],h6[id]{font-size:1.8rem}p[id]{margin:1rem 0}.psg-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;height:100%;font-size:1.6rem;font-family:Arial,ヒラギノ角ゴ Pro W3,Hiragino Kaku Gothic Pro,Osaka,メイリオ,Meiryo,MS\ Pゴシック,MS PGothic,sans-serif;color:#444;line-height:1.5}.psg-menu{width:240px;height:100%;padding:2rem 3.2rem;border-right:1px solid #ddd;overflow-y:scroll}.psg-logo{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:2rem}.psg-logo>img{width:100%;margin-left:-50px}.psg-ComponentList__item{display:block;color:#3f526b;padding:12px 8px}.psg-ComponentList__item:hover{background-color:#eee}.psg-main{-webkit-box-flex:1;-ms-flex:1 1 0%;flex:1 1 0%;height:100%;background-color:#fff;overflow-y:scroll}.psg-title{width:100%;padding:40px 60px;font-size:2rem;text-align:center;color:#fff;background-color:#e23b00}.psg-container{margin:50px 0}.psg-component-title.psg-component-title{margin:2rem 0 1rem;font-size:3.2rem;font-weight:700;line-height:1.6;color:#3f526b}.psg-section{max-width:580px;margin:0 auto}.psg-contents>p,.psg-contents>pre{margin:2rem 0}hr.psg-separator{margin:4rem 0;border:0;border-top:1px solid #ddd}.psg-colorPalette{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap}.psg-colorBox{width:180px;box-shadow:1px 1px 10px 0 rgba(0,0,0,.2);margin:3rem}.psg-colorBox__sample{height:100px}.psg-colorBox__name{padding:1em;font-size:1.4rem;text-align:center}.class{color:blue;color:red}</style>
<style>.hljs{display:block;overflow-x:auto;padding:.5em;color:#333;background:#f8f8f8;-webkit-text-size-adjust:none}.diff .hljs-header,.hljs-comment{color:#998;font-style:italic}.css .rule .hljs-keyword,.hljs-keyword,.hljs-winutils,.nginx .hljs-title{color:#333;font-weight:700}.hljs-subst{color:#333}.hljs-request,.hljs-status{color:#333;font-weight:700}.hljs-hexcolor,.hljs-number,.ruby .hljs-constant{color:teal}.hljs-doctag,.hljs-string,.hljs-tag .hljs-value,.tex .hljs-formula{color:#d14}.hljs-id,.hljs-title,.scss .hljs-preprocessor{color:#900;font-weight:700}.hljs-list .hljs-keyword,.hljs-subst{font-weight:400}.hljs-class .hljs-title,.hljs-type,.tex .hljs-command,.vhdl .hljs-literal{color:#458;font-weight:700}.django .hljs-tag .hljs-keyword,.hljs-rule .hljs-property,.hljs-tag,.hljs-tag .hljs-title{color:navy;font-weight:400}.hljs-attribute,.hljs-name,.hljs-variable,.lisp .hljs-body{color:teal}.hljs-regexp{color:#009926}.clojure .hljs-keyword,.hljs-prompt,.hljs-symbol,.lisp .hljs-keyword,.ruby .hljs-symbol .hljs-string,.scheme .hljs-keyword,.tex .hljs-special{color:#990073}.hljs-built_in{color:#0086b3}.hljs-cdata,.hljs-doctype,.hljs-pi,.hljs-pragma,.hljs-preprocessor,.hljs-shebang{color:#999;font-weight:700}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.diff .hljs-change{background:#0086b3}.hljs-chunk{color:#aaa}/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}iframe,img{border:0}svg:not(:root){overflow:hidden}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:0;margin:0}legend{border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}button,fieldset,legend,td,th{padding:0}*,::after,::before,input[type=search]{box-sizing:inherit}blockquote,body,dd,dl,figure,h1,h2,h3,h4,h5,h6,p,pre{margin:0}button{background:0 0;border:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}ol,ul{list-style:none;margin:0;padding:0}[tabindex="-1"]:focus{outline:none!important}html.psg-theme{font-size:62.5%}body,html{height:100%;overflow-y:hidden}h1[id],h2[id],h3[id],h4[id],h5[id],h6[id]{margin:2rem 0 1rem;font-weight:400;line-height:1.6;color:#444}h1[id]{font-size:2.8rem}h2[id]{font-size:2.4rem}h3[id]{font-size:2rem}h4[id],h5[id],h6[id]{font-size:1.8rem}p[id]{margin:1rem 0}.psg-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;font-size:1.6rem;font-family:Arial,ヒラギノ角ゴ Pro W3,Hiragino Kaku Gothic Pro,Osaka,メイリオ,Meiryo,MS\ Pゴシック,MS PGothic,sans-serif;color:#444;line-height:1.5}.psg-menu{width:240px;height:100%;padding:2rem 3.2rem;border-right:1px solid #ddd;overflow-y:scroll}.psg-logo{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;margin-bottom:2rem}.psg-logo>img{width:100%;margin-left:-50px}.psg-ComponentList__item{display:block;color:#3f526b;padding:12px 8px}.psg-ComponentList__item:hover{background-color:#eee}.psg-main{-webkit-box-flex:1;-webkit-flex:1 1 0%;-ms-flex:1 1 0%;flex:1 1 0%;height:100%;background-color:#fff;overflow-y:scroll}.psg-title{width:100%;padding:40px 60px;font-size:2rem;text-align:center;color:#fff;background-color:#e23b00}.psg-container{margin:50px 0}.psg-component-title.psg-component-title{margin:2rem 0 1rem;font-size:3.2rem;font-weight:700;line-height:1.6;color:#3f526b}.psg-section{max-width:580px;margin:0 auto}.psg-contents>p,.psg-contents>pre{margin:2rem 0}hr.psg-separator{margin:4rem 0;border:0;border-top:1px solid #ddd}.psg-colorPalette{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap}.psg-colorBox{width:180px;box-shadow:1px 1px 10px 0 rgba(0,0,0,.2);margin:3rem}.psg-colorBox__sample{height:100px}.psg-colorBox__name{padding:1em;font-size:1.4rem;text-align:center}.class{color:red}</style>
</head>

<body>
Expand Down