Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: config/_config.yml views/_partials/csscode.jade views/_partials/jscode.jade
- Loading branch information
Showing
15 changed files
with
611 additions
and
303 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ lint.html | |
config/_maxcdn.yml | ||
shelljs_* | ||
*.log | ||
Dockme.yml |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env node | ||
var path = require('path'); | ||
var yaml = require('js-yaml'); | ||
var exec = require('child_process').execSync; | ||
var fs = require('fs'); | ||
var sri = require('sri-toolbox'); | ||
|
||
var basedir = path.join(__dirname, '..'); | ||
var configFile = path.join(basedir, 'config', '_config.yml'); | ||
var config = yaml.safeLoad(fs.readFileSync(configFile)); | ||
|
||
// create backup file | ||
fs.createReadStream(configFile) | ||
.pipe(fs.createWriteStream(configFile + '.bak')); | ||
|
||
function buildPath(d) { | ||
return path.join(basedir, 'public', | ||
d.replace('https://maxcdn.bootstrapcdn.com/','')); | ||
} | ||
|
||
function digest(file) { | ||
return 'sha256-' + | ||
exec('cat ' + file + ' | openssl dgst -sha256 -binary | openssl enc -base64 -A').toString() + | ||
' sha512-' + | ||
exec('cat ' + file + ' | openssl dgst -sha512 -binary | openssl enc -base64 -A').toString(); | ||
} | ||
|
||
// bootswatch | ||
var bootswatch = buildPath(config.bootswatch.bootstrap); | ||
for (var i = 0; i < config.bootswatch.themes.length; i++) { | ||
var theme = config.bootswatch.themes[i]; | ||
var file = bootswatch.replace('SWATCH_VERSION', config.bootswatch.version) | ||
.replace('SWATCH_NAME', theme.name); | ||
|
||
if (config.bootswatch.themes[i].sri === undefined) { | ||
config.bootswatch.themes[i].sri = digest(file); | ||
} | ||
} | ||
|
||
// bootlint | ||
for (var i = 0; i < config.bootlint.length; i++) { | ||
var bootlint = config.bootlint[i]; | ||
var file = buildPath(bootlint.javascript); | ||
|
||
if (config.bootlint[i].javascript_sri === undefined) { | ||
config.bootlint[i].javascript_sri = digest(file); | ||
} | ||
} | ||
|
||
// bootstrap | ||
for (var i = 0; i < config.bootstrap.length; i++) { | ||
var bootstrap = config.bootstrap[i]; | ||
|
||
var javascript = buildPath(bootstrap.javascript); | ||
if (config.bootstrap[i].javascript_sri === undefined) { | ||
config.bootstrap[i].javascript_sri = digest(javascript); | ||
} | ||
|
||
var stylesheet = buildPath(bootstrap.stylesheet); | ||
if (config.bootstrap[i].stylesheet_sri === undefined) { | ||
config.bootstrap[i].stylesheet_sri = digest(stylesheet); | ||
} | ||
} | ||
|
||
// fontawesome | ||
for (var i = 0; i < config.fontawesome.length; i++) { | ||
var stylesheet = buildPath(config.fontawesome[i].stylesheet); | ||
|
||
if (config.fontawesome[i].stylesheet_sri === undefined) { | ||
config.fontawesome[i].stylesheet_sri = digest(stylesheet); | ||
} | ||
} | ||
|
||
fs.writeFileSync(configFile, yaml.dump(config)); |
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,18 +1,14 @@ | ||
.well.hidden(id=name) | ||
.form-group | ||
label(for='html_' + name) HTML | ||
input.form-control(type='text', id='html_' + name, value='<link href="' + cssPath + '" rel="stylesheet">') | ||
- if (integrity) | ||
.form-group | ||
label(for='html_sri_' + name) HTML with SRI | ||
input.form-control(type='text', id='html_sri_' + name, value='<link href="' + cssPath + '" rel="stylesheet" integrity="' + integrity + '" crossorigin="anonymous">') | ||
input.form-control(type='text', id='html_' + name, value='<link href="' + file + '" rel="stylesheet" integrity="' + sri + '" crossorigin="anonymous">') | ||
.form-group | ||
label(for='jade_' + name) | ||
a(href="http://jade-lang.com/", target="_blank") Jade | ||
input.form-control(type='text', id='jade_' + name, value='link(href="' + cssPath + '", rel="stylesheet")') | ||
input.form-control(type='text', id='jade_' + name, value='link(href="' + file + '", rel="stylesheet" integrity="' + sri + '" crossorigin="anonymous")') | ||
.form-group | ||
label(for='haml_' + name) | ||
a(href="http://haml.info/", target="_blank") Haml | ||
input.form-control(type='text', id='haml_' + name, value='%link{:href=>"' + cssPath + '", :rel=>"stylesheet"}') | ||
input.form-control(type='text', id='haml_' + name, value='%link{href: "' + file + '", rel: "stylesheet", integrity: "' + sri + '" crossorigin: "anonymous"}') | ||
|
||
//- vim: ft=jade sw=4 sts=4 et: |
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,18 +1,14 @@ | ||
.well.hidden(id=name) | ||
.form-group | ||
label(for='haml_' + name) HTML | ||
input.form-control(type='text', id='html_' + name, value='<script src="' + jsPath + '"></script>') | ||
- if (integrity) | ||
.form-group | ||
label(for='html_sri_' + name) HTML with SRI | ||
input.form-control(type='text', id='html_sri_' + name, value='<script src="' + jsPath + '" integrity="' + integrity + '" crossorigin="anonymous"></script>') | ||
label(for='html_' + name) HTML | ||
input.form-control(type='text', id='html_sri_' + name, value='<script src="' + file + '" integrity="' + sri + '" crossorigin="anonymous"></script>') | ||
.form-group | ||
label(for='haml_' + name) | ||
label(for='jade_' + name) | ||
a(href="http://jade-lang.com/", target="_blank") Jade | ||
input.form-control(type='text', id='jade_' + name, value='script(src="' + jsPath + '")') | ||
input.form-control(type='text', id='jade_' + name, value='script(src="' + file + '" integrity="' + sri + '" crossorigin="anonymous")') | ||
.form-group | ||
label(for='haml_' + name) | ||
a(href="http://haml.info/", target="_blank") Haml | ||
input.form-control(type='text', id='haml_' + name, value='%script{:src=>"' + jsPath + '"}') | ||
input.form-control(type='text', id='haml_' + name, value='%script{src: "' + file + '" integrity: "' + sri + '" crossorigin: "anonymous"}') | ||
|
||
//- vim: ft=jade sw=4 sts=4 et: |
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
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
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