Skip to content

Commit c91e6be

Browse files
committed
config one css files
1 parent 75c6746 commit c91e6be

File tree

7 files changed

+53
-16
lines changed

7 files changed

+53
-16
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# ignore
22
node_modules
3-
dist/*
4-
!dist/CoCreate.min.js
3+
dist
4+
; !dist/CoCreate.min.js

dist/CoCreate.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@
5252
"clean-webpack-plugin": "^3.0.0",
5353
"css-loader": "^5.1.2",
5454
"file-loader": "^6.2.0",
55+
"html-webpack-inline-source-plugin": "^0.0.10",
5556
"html-webpack-plugin": "^5.3.1",
57+
"html-webpack-tags-plugin": "^3.0.0",
58+
"mini-css-extract-plugin": "^1.4.0",
5659
"style-loader": "^2.0.0",
5760
"terser-webpack-plugin": "5.1.0",
5861
"webpack": "^5.24.4",

src/components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ addLazily('pickr', '.color-pickr', ()=> import (/*webpackChunkName: "pickr-chunk
8888
// addLazily('uppy', '#drag-drop-area', ()=> import (/*webpackChunkName: "uppy-chunk"*/ '@cocreate/uppy'))
8989

9090
// Test component
91-
// addLazily('test', '[data-test]', ()=> import (/*webpackChunkName: "test-chunk"*/ '@cocreate/test'))
91+
// addLazily('test', '[data-test]', ()=> import (webpackChunkName: "test-chunk" '@cocreate/test'))

src/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// core components
22
import core from "./core.js"
3-
import css from '@cocreate/cocreatecss';
43
import observer from '@cocreate/observer';
4+
import css from '@cocreate/cocreatecss';
5+
// import css from '../../CoCreateCSS/src';
56

67
(async function() {
78

@@ -13,11 +14,6 @@ import observer from '@cocreate/observer';
1314
Object.assign(window.CoCreate, {components: importObj.default})
1415

1516

16-
// // prefetched - downloads after main chunk has complete and in idle mode. If no longer idle will pause then resume when not idle. Priority using 1, -1 true=0
17-
// importObj = await
18-
// import ( /* webpackChunkName: "htmltags-chunk", webpackPrefetch: true */
19-
// "../CoCreate-components/CoCreate-htmltags/src/index.js");
20-
// Object.assign(window.CoCreate, {htmltags: importObj.default})
2117

2218
})()
2319

webpack.config.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const TerserPlugin = require("terser-webpack-plugin");
88
let isProduction = process.env.NODE_ENV === 'production';
99
const getLogger = require('webpack-log');
1010
const log = getLogger({ name: 'webpack-batman' });
11-
11+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1212

1313
log.info(__filename);
1414

@@ -27,7 +27,7 @@ module.exports = {
2727
// Path and filename of your result bundle.
2828
// Webpack will bundle all JavaScript into this file
2929
output: {
30-
path: path.resolve(__dirname, 'dist'),
30+
path: path.resolve(__dirname, 'dist'),
3131
filename: isProduction ? '[name].min.js' : '[name].js',
3232
// filename: (pathData) => {
3333
// if (isProduction) {
@@ -48,6 +48,18 @@ module.exports = {
4848
...(isProduction ? { /*publicPath: 'https://cdn.cocreate.app/',*/ } : {}),
4949

5050
},
51+
52+
plugins: [
53+
new CleanWebpackPlugin(),
54+
new MiniCssExtractPlugin({
55+
// Options similar to the same options in webpackOptions.output
56+
// both options are optional
57+
filename: '[name].css',
58+
chunkFilename: '[id].css',
59+
}),
60+
],
61+
62+
5163
devServer: {
5264
hot: true,
5365
},
@@ -76,14 +88,13 @@ module.exports = {
7688
},
7789
{
7890
test: /\.css$/,
79-
use: ['style-loader', 'css-loader']
91+
use: [MiniCssExtractPlugin.loader, 'css-loader',
92+
// "file-loader",
93+
]
8094
},
8195
]
8296
},
8397

84-
plugins: [
85-
new CleanWebpackPlugin()
86-
],
8798

8899
optimization: {
89100
minimize: true,

yarn.lock

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5842,6 +5842,15 @@ html-minifier-terser@^5.0.1:
58425842
relateurl "^0.2.7"
58435843
terser "^4.6.3"
58445844

5845+
html-webpack-inline-source-plugin@^0.0.10:
5846+
version "0.0.10"
5847+
resolved "https://registry.yarnpkg.com/html-webpack-inline-source-plugin/-/html-webpack-inline-source-plugin-0.0.10.tgz#89bd5f761e4f16902aa76a44476eb52831c9f7f0"
5848+
integrity sha512-0ZNU57u7283vrXSF5a4VDnVOMWiSwypKIp1z/XfXWoVHLA1r3Xmyxx5+Lz+mnthz/UvxL1OAf41w5UIF68Jngw==
5849+
dependencies:
5850+
escape-string-regexp "^1.0.5"
5851+
slash "^1.0.0"
5852+
source-map-url "^0.4.0"
5853+
58455854
html-webpack-plugin@^5.3.1:
58465855
version "5.3.1"
58475856
resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-5.3.1.tgz#8797327548e3de438e3494e0c6d06f181a7f20d1"
@@ -5853,6 +5862,15 @@ html-webpack-plugin@^5.3.1:
58535862
pretty-error "^2.1.1"
58545863
tapable "^2.0.0"
58555864

5865+
html-webpack-tags-plugin@^3.0.0:
5866+
version "3.0.0"
5867+
resolved "https://registry.yarnpkg.com/html-webpack-tags-plugin/-/html-webpack-tags-plugin-3.0.0.tgz#e237c826eec147a22bbe6fcdd93d1de4490d9d9d"
5868+
integrity sha512-+4H3546xwpiLiznVyvf0Tk/2fKvvkW/BKbFDtbaFilEISINzSwtMeHIssC02qdPiZhNkgJPDJV14P53XvXwAsg==
5869+
dependencies:
5870+
glob "^7.1.6"
5871+
minimatch "^3.0.4"
5872+
slash "^3.0.0"
5873+
58565874
htmlparser2@^3.10.1:
58575875
version "3.10.1"
58585876
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f"
@@ -9038,6 +9056,16 @@ sirv@^1.0.7:
90389056
mime "^2.3.1"
90399057
totalist "^1.0.0"
90409058

9059+
slash@^1.0.0:
9060+
version "1.0.0"
9061+
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
9062+
integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=
9063+
9064+
slash@^3.0.0:
9065+
version "3.0.0"
9066+
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
9067+
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
9068+
90419069
snapdragon-node@^2.0.1:
90429070
version "2.1.1"
90439071
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"

0 commit comments

Comments
 (0)