Skip to content

Commit c5b99fc

Browse files
committed
Improve zip-examples.js
Only include the needed dist files
1 parent df763d6 commit c5b99fc

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

build/zip-examples.js

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,43 @@ sh.cd(path.join(__dirname, '..'))
2727

2828
// remove any previously created folder with the same name
2929
sh.rm('-rf', folderName)
30+
3031
// create any folders so that `cp` works
3132
sh.mkdir('-p', folderName)
3233
sh.mkdir('-p', `${folderName}/assets/brand/`)
34+
sh.mkdir('-p', `${folderName}/assets/dist/css/`)
35+
sh.mkdir('-p', `${folderName}/assets/dist/js/`)
3336

3437
sh.cp('-Rf', `_gh_pages/docs/${versionShort}/examples/*`, folderName)
35-
sh.cp('-Rf', `_gh_pages/docs/${versionShort}/dist/`, `${folderName}/assets/`)
36-
// also copy the two brand images we use in the examples
37-
sh.cp('-f', [
38-
`_gh_pages/docs/${versionShort}/assets/brand/bootstrap-logo.svg`,
39-
`_gh_pages/docs/${versionShort}/assets/brand/bootstrap-logo-white.svg`
40-
], `${folderName}/assets/brand/`)
38+
39+
// these are the files we need in the examples
40+
const cssFiles = [
41+
'bootstrap.min.css',
42+
'bootstrap.min.css.map',
43+
'bootstrap.rtl.min.css',
44+
'bootstrap.rtl.min.css.map'
45+
]
46+
const jsFiles = [
47+
'bootstrap.bundle.min.js',
48+
'bootstrap.bundle.min.js.map'
49+
]
50+
const imgFiles = [
51+
'bootstrap-logo.svg',
52+
'bootstrap-logo-white.svg'
53+
]
54+
55+
cssFiles.forEach(file => {
56+
sh.cp('-f', `_gh_pages/docs/${versionShort}/dist/css/${file}`, `${folderName}/assets/dist/css/`)
57+
})
58+
59+
jsFiles.forEach(file => {
60+
sh.cp('-f', `_gh_pages/docs/${versionShort}/dist/js/${file}`, `${folderName}/assets/dist/js/`)
61+
})
62+
63+
imgFiles.forEach(file => {
64+
sh.cp('-f', `_gh_pages/docs/${versionShort}/assets/brand/${file}`, `${folderName}/assets/brand/`)
65+
})
66+
4167
sh.rm(`${folderName}/index.html`)
4268

4369
// get all examples' HTML files

0 commit comments

Comments
 (0)