Add bootstrap to scss build

This commit is contained in:
Cody Baker 2021-09-08 13:36:00 -06:00
parent 8bc0d5640d
commit e08528a9c5
5 changed files with 1459 additions and 1697 deletions

View File

@ -1674,6 +1674,11 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
"dev": true
},
"bootstrap": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz",
"integrity": "sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

View File

@ -25,6 +25,7 @@
},
"dependencies": {
"amphtml-validator": "^1.0.35",
"bootstrap": "^4.4.1",
"purify-css": "^1.2.5"
}
}

View File

@ -1,4 +1,7 @@
const path = require('path');
const scssPath = path.resolve(__dirname, '../../website/src/scss');
console.log(path.resolve(__dirname, 'node_modules/bootstrap', require('bootstrap/package.json').sass));
module.exports = {
@ -9,7 +12,8 @@ module.exports = {
}),
entry: [
'../../website/src/scss/main.scss',
path.resolve(scssPath, 'bootstrap.scss'),
path.resolve(scssPath, 'main.scss'),
],
output: {
@ -17,6 +21,12 @@ module.exports = {
filename: 'js/main.js',
},
resolve: {
alias: {
bootstrap: path.resolve(__dirname, 'node_modules/bootstrap', require('bootstrap/package.json').sass),
},
},
module: {
rules: [{
test: /\.js$/,
@ -32,9 +42,15 @@ module.exports = {
use: [{
loader: 'file-loader',
options: {
name: 'main.css',
outputPath: './css',
sourceMap: true,
outputPath: (url, entryPath, context) => {
if (0 === entryPath.indexOf(scssPath)) {
const outputFile = entryPath.slice(entryPath.lastIndexOf('/') + 1, -5)
const outputPath = entryPath.slice(0, entryPath.lastIndexOf('/')).slice(scssPath.length + 1)
return `./css/${outputPath}/${outputFile}.css`
}
return `./css/${url}`
},
},
}, {
loader: 'postcss-loader',

File diff suppressed because it is too large Load Diff

1
website/src/scss/bootstrap.scss vendored Normal file
View File

@ -0,0 +1 @@
@import '~bootstrap';