Skip to content

Commit

Permalink
Add ESM build
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Jun 30, 2020
1 parent 54bd59a commit 54c9d67
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/_files.yml
Expand Up @@ -3,8 +3,10 @@ bootstrap:
stylesheet: 'https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css'
javascript: 'https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js'
javascriptBundle: 'https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.bundle.min.js'
javascriptEsm: 'https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.esm.min.js'
javascriptSri: sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/
javascriptBundleSri: sha384-DBjhmceckmzwrnMMrjI7BvG2FmRuxQVaTfFYHgfnrdfqMhxKt445b7j3KBQLolRl
javascriptEsmSri: sha384-sKZy8g2KJhBTFCD6cIg8d4EifJxaa8c/iYIERdeKorHWhAgZgQOfqOKMe3xBqye1
stylesheetSri: sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I
- version: 4.5.0
current: true
Expand Down
10 changes: 9 additions & 1 deletion scripts/integrity.js
Expand Up @@ -54,12 +54,16 @@ files.bootlint.forEach((bootlint) => {
files.bootstrap.forEach((bootstrap) => {
const javascript = buildPath(bootstrap.javascript);
const stylesheet = buildPath(bootstrap.stylesheet);
let { javascriptBundle } = bootstrap;
let { javascriptBundle, javascriptEsm } = bootstrap;

if (javascriptBundle) {
javascriptBundle = buildPath(bootstrap.javascriptBundle);
}

if (javascriptEsm) {
javascriptEsm = buildPath(bootstrap.javascriptEsm);
}

if (exists(javascript)) {
bootstrap.javascriptSri = generateSri(javascript);
}
Expand All @@ -68,6 +72,10 @@ files.bootstrap.forEach((bootstrap) => {
bootstrap.javascriptBundleSri = generateSri(javascriptBundle);
}

if (javascriptEsm && exists(javascriptEsm)) {
bootstrap.javascriptEsmSri = generateSri(javascriptEsm);
}

if (exists(stylesheet)) {
bootstrap.stylesheetSri = generateSri(stylesheet);
}
Expand Down
16 changes: 16 additions & 0 deletions views/index.pug
Expand Up @@ -65,4 +65,20 @@ block content

include _partials/jscode.pug

if (item.javascriptEsm)
-var name = `quickstartjsesm_${item.version.replace(/\./g, '_')}`;
-var file = item.javascriptEsm;
-var sri = item.javascriptEsmSri;
-var formId = `${name}_form`;

.form-group.my-4
label.font-weight-bold(for=formId) Complete JavaScript ESM Build
.input-group.input-group-lg
input.form-control(id=formId, type='text', readonly, value=file)
.input-group-append
button.btn.btn-dark.dropdown-toggle(type='button', data-toggle='collapse', data-target=`#${name}`, aria-label='Toggle Dropdown', aria-expanded='false', aria-controls=name)
span.form-text.text-muted Click to copy

include _partials/jscode.pug

//- vim: ft=pug sw=4 sts=4 et:

0 comments on commit 54c9d67

Please sign in to comment.