initial implementation of bootstrap v5, purgecss, postcss, autoprefixer
This commit is contained in:
parent
7efb7f7fcc
commit
d9b9da830b
9 changed files with 998 additions and 62 deletions
|
@ -1,5 +1,5 @@
|
|||
/* This file is for your main application css. */
|
||||
@import "./phoenix.css";
|
||||
/* Bootstrap v5 */
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
|
||||
/* LiveView specific classes for your customizations */
|
||||
.phx-no-feedback.invalid-feedback,
|
||||
|
@ -55,30 +55,6 @@
|
|||
}
|
||||
|
||||
/* Alerts and form errors */
|
||||
.alert {
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.alert-info {
|
||||
color: #31708f;
|
||||
background-color: #d9edf7;
|
||||
border-color: #bce8f1;
|
||||
}
|
||||
.alert-warning {
|
||||
color: #8a6d3b;
|
||||
background-color: #fcf8e3;
|
||||
border-color: #faebcc;
|
||||
}
|
||||
.alert-danger {
|
||||
color: #a94442;
|
||||
background-color: #f2dede;
|
||||
border-color: #ebccd1;
|
||||
}
|
||||
.alert p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.alert:empty {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ import { Socket } from "phoenix";
|
|||
import topbar from "topbar";
|
||||
import { LiveSocket } from "phoenix_live_view";
|
||||
|
||||
// Bootstrap v5 js imports
|
||||
import Collapse from "bootstrap/js/dist/collapse";
|
||||
import Dropdown from "bootstrap/js/dist/dropdown";
|
||||
|
||||
// LiveSocket setup
|
||||
let csrfToken = document
|
||||
.querySelector("meta[name='csrf-token']")
|
||||
.getAttribute("content");
|
||||
|
|
911
assets/package-lock.json
generated
911
assets/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,8 @@
|
|||
"watch": "webpack --mode development --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.8.4",
|
||||
"bootstrap": "^5.0.0-beta2",
|
||||
"phoenix": "file:../deps/phoenix",
|
||||
"phoenix_html": "file:../deps/phoenix_html",
|
||||
"phoenix_live_view": "file:../deps/phoenix_live_view",
|
||||
|
@ -15,11 +17,17 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "^7.x",
|
||||
"@babel/preset-env": "^7.x",
|
||||
"autoprefixer": "^10.2.4",
|
||||
"babel-loader": "^8.x",
|
||||
"copy-webpack-plugin": "^7.x",
|
||||
"css-loader": "^5.x",
|
||||
"css-minimizer-webpack-plugin": "^1.x",
|
||||
"glob-all": "^3.2.1",
|
||||
"mini-css-extract-plugin": "^1.x",
|
||||
"postcss": "^8.2.6",
|
||||
"postcss-loader": "^5.0.0",
|
||||
"postcss-scss": "^3.0.4",
|
||||
"purgecss-webpack-plugin": "^4.0.2",
|
||||
"sass": "^1.x",
|
||||
"sass-loader": "^10.x",
|
||||
"webpack": "^5.x",
|
||||
|
|
5
assets/postcss.config.js
Normal file
5
assets/postcss.config.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
parser: require("postcss-scss"),
|
||||
|
||||
plugins: [require("autoprefixer")],
|
||||
};
|
|
@ -1,8 +1,9 @@
|
|||
const path = require("path");
|
||||
const glob = require("glob");
|
||||
const glob = require("glob-all");
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const PurgecssPlugin = require("purgecss-webpack-plugin");
|
||||
|
||||
module.exports = (env, options) => {
|
||||
const devMode = options.mode !== "production";
|
||||
|
@ -27,7 +28,12 @@ module.exports = (env, options) => {
|
|||
},
|
||||
{
|
||||
test: /\.[s]?css$/,
|
||||
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
"css-loader",
|
||||
"sass-loader",
|
||||
"postcss-loader",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -36,7 +42,22 @@ module.exports = (env, options) => {
|
|||
new CopyWebpackPlugin({
|
||||
patterns: [{ from: "static/", to: "../" }],
|
||||
}),
|
||||
],
|
||||
].concat(
|
||||
devMode
|
||||
? []
|
||||
: [
|
||||
new PurgecssPlugin({
|
||||
paths: glob.sync([
|
||||
"../**/*.html.leex",
|
||||
"../**/*.html.eex",
|
||||
"../**/views/**/*.ex",
|
||||
"../**/live/**/*.ex",
|
||||
"./js/**/*.js",
|
||||
]),
|
||||
safelist: [/phx/, /topbar/],
|
||||
}),
|
||||
]
|
||||
),
|
||||
optimization: {
|
||||
minimizer: ["...", new CssMinimizerPlugin()],
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue