File tree Expand file tree Collapse file tree
test/manual/watch-imported-css-inline Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Manual test
2+
3+ The issue [ Inclining imported css doesn't work in watch mode if a leaf component content is changed] ( https://github.com/webdiscus/html-bundler-webpack-plugin/issues/74 ) .
4+
5+ TODO: describe steps to reproduce the issue
6+
7+ 1 . start development: ` npm start `
8+ 2 . change ` src/home.html ` => ok
9+ 3 . change ` src/style.css ` => ok
10+ 4 . change ` src/main.js ` => ok
11+ 5 . change ` src/component-a/style.css ` => ok
12+ 6 . change ` src/component-a/index.js ` => ok
13+ 7 . change ` src/component-b/style.css ` => ok
14+ 8 . change ` src/component-b/index.js ` => ok
Original file line number Diff line number Diff line change 1+ {
2+ "scripts" : {
3+ "start" : " webpack serve --mode development" ,
4+ "watch" : " webpack watch --mode development" ,
5+ "build" : " webpack --mode=production --progress"
6+ },
7+ "devDependencies" : {
8+ "html-bundler-webpack-plugin" : " file:../../.."
9+ }
10+ }
Original file line number Diff line number Diff line change 1+ // local style
2+ import './style.css' ;
3+
4+ // node module component importing an own css file
5+ import '@test/import-css' ;
6+
7+ console . log ( '>> component a' ) ;
8+
9+ export default `<div class="component-a">Component A</div>` ;
Original file line number Diff line number Diff line change 1+ .component-a {
2+ color : red;
3+ }
Original file line number Diff line number Diff line change 1+ import './style.css' ;
2+
3+ console . log ( '>> component b' ) ;
4+
5+ export default `<div class="component-b">Component B</div>` ;
Original file line number Diff line number Diff line change 1+ .component-b {
2+ color : blue;
3+ }
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html >
3+ < head >
4+ < title > Home</ title >
5+ </ head >
6+ < body >
7+ < h1 > Hello World!</ h1 >
8+ < div id ="root "> </ div >
9+ < div class ="toolbar "> Component Toolbar from node_modules</ div >
10+ < script src ="./main.js "> </ script >
11+ </ body >
12+ </ html >
Original file line number Diff line number Diff line change 1+ import './style.css' ;
2+
3+ import componentA from './components/a' ;
4+ import componentB from './components/b' ;
5+
6+ document . getElementById ( 'root' ) . innerHTML = componentA + componentB ;
7+
8+ console . log ( '>> main' ) ;
Original file line number Diff line number Diff line change 1+ h1 {
2+ color : seagreen;
3+ }
Original file line number Diff line number Diff line change 1+ const path = require ( 'path' ) ;
2+ const HtmlBundlerPlugin = require ( 'html-bundler-webpack-plugin' ) ;
3+
4+ module . exports = {
5+ mode : 'production' ,
6+ stats : 'minimal' ,
7+
8+ output : {
9+ path : path . join ( __dirname , 'dist/' ) ,
10+ } ,
11+
12+ plugins : [
13+ new HtmlBundlerPlugin ( {
14+ entry : {
15+ index : './src/home.html' ,
16+ } ,
17+ js : {
18+ inline : true ,
19+ } ,
20+ css : {
21+ inline : true ,
22+ } ,
23+ } ) ,
24+ ] ,
25+
26+ module : {
27+ rules : [
28+ {
29+ test : / \. ( c s s ) $ / ,
30+ use : [ 'css-loader' ] ,
31+ } ,
32+ ] ,
33+ } ,
34+
35+ devServer : {
36+ static : {
37+ directory : path . join ( __dirname , 'dist' ) ,
38+ } ,
39+ watchFiles : {
40+ paths : [ 'src/**/*.*' ] ,
41+ options : {
42+ usePolling : true ,
43+ } ,
44+ } ,
45+ } ,
46+ } ;
You can’t perform that action at this time.
0 commit comments