Skip to content

Commit

Permalink
fix: add min.css to /latest
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Dec 13, 2022
1 parent 3ed0f01 commit 0b9b8e0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 28 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ jobs:
destination: /CoCreateCSS/latest
acl: public-read
invalidations: true
- name: upload bundle as latest
uses: CoCreate-app/CoCreate-s3@master
with:
aws-key-id: "${{ secrets.AWSACCESSKEYID }}"
aws-access-key: "${{ secrets.AWSSECERTACCESSKEY }}"
bucket: testcrudbucket
source: ./dist/CoCreate.min.css
destination: /latest
acl: public-read
invalidations: true
docs:
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.1.3",
"css-minimizer-webpack-plugin": "^4.2.2",
"file-loader": "^6.2.0",
"html-webpack-inline-source-plugin": "^0.0.10",
"html-webpack-plugin": "^5.3.1",
"html-webpack-tags-plugin": "^3.0.0",
"mini-css-extract-plugin": "^1.5.0",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.1.1",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.24.4",
Expand Down
37 changes: 13 additions & 24 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const path = require("path")

const { CleanWebpackPlugin } = require("clean-webpack-plugin")
const TerserPlugin = require("terser-webpack-plugin")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');

let isProduction = process.env.NODE_ENV === "production"
const { CleanWebpackPlugin } = require("clean-webpack-plugin")

module.exports = {
entry: {
Expand All @@ -11,23 +14,21 @@ module.exports = {
output: {
path: path.resolve(__dirname, "dist"),
filename: isProduction ? "[name].min.js" : "[name].js",
chunkFilename: isProduction ? '[name].min.js' : '[name].js',
libraryTarget: "umd",
libraryExport: "default",
library: ["CoCreate", "css"],
globalObject: "this",
// publicPath: 'https://server.cocreate.app/CoCreateJS/dist/'
...(isProduction ? { /*publicPath: 'https://cdn.cocreate.app/',*/ } : {}),
},

plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: "[name].css",
filename: isProduction ? 'CoCreate.min.css' : 'CoCreate.css',
}),
],
// Default mode for Webpack is production.
// Depending on mode Webpack will apply different things
// on final bundle. For now we don't need production's JavaScript
// minifying and other thing so let's set mode to development

mode: isProduction ? "production" : "development",
module: {
rules: [
Expand All @@ -44,10 +45,9 @@ module.exports = {
{
test: /.css$/i,
use: [
{ loader: "style-loader", options: { injectType: "linkTag" } },
"file-loader",
],
// use: [MiniCssExtractPlugin.loader, { loader: "style-loader", options: { injectType: "linkTag" } }],
MiniCssExtractPlugin.loader,
'css-loader'
]
},
],
},
Expand All @@ -58,29 +58,18 @@ module.exports = {
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin(),
new TerserPlugin({
extractComments: true,
// cache: true,
parallel: true,
// sourceMap: true, // Must be set to true if using source-maps in production
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
// extractComments: 'all',
compress: {
drop_console: true,
},
},
}),
],
splitChunks: {
chunks: "all",
minSize: 200,
// maxSize: 99999,
//minChunks: 1,

cacheGroups: {
defaultVendors: false,
},
},
]
},
}

0 comments on commit 0b9b8e0

Please sign in to comment.