-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pug): correct resolving required resources in multiple pages
- Loading branch information
Showing
25 changed files
with
150 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="css/main.4f0fb2f1.css"><link rel="stylesheet" href="css/style.f07588a7.css"><script src="js/main.5317c1f6.js"></script></head><body><h4>Default layout</h4><h1>About</h1><script src="js/script.1.e55bdc4a.js"></script></body></html> |
12 changes: 12 additions & 0 deletions
12
test/cases/_pug/resolve-js-css-multipage/expected/css/main.4f0fb2f1.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
body { | ||
font-size: 18px; | ||
font-family: Arial, sans-serif; | ||
} | ||
|
||
h1 { | ||
color: deepskyblue; | ||
} | ||
|
||
h4 { | ||
color: #9f9f9f; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/cases/_pug/resolve-js-css-multipage/expected/css/style.dd1336a7.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: orangered; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/cases/_pug/resolve-js-css-multipage/expected/css/style.f07588a7.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: seagreen; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="css/main.4f0fb2f1.css"><script src="js/main.5317c1f6.js"></script></head><body><h4>Default layout</h4><h1>Start page</h1></body></html> |
1 change: 1 addition & 0 deletions
1
test/cases/_pug/resolve-js-css-multipage/expected/js/main.5317c1f6.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(">> main"); |
1 change: 1 addition & 0 deletions
1
test/cases/_pug/resolve-js-css-multipage/expected/js/script.1.e55bdc4a.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(">> about"); |
1 change: 1 addition & 0 deletions
1
test/cases/_pug/resolve-js-css-multipage/expected/js/script.26d1b659.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(">> news"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="css/main.4f0fb2f1.css"><link rel="stylesheet" href="css/style.dd1336a7.css"><script src="js/main.5317c1f6.js"></script></head><body><h4>Default layout</h4><h1>News</h1><script src="js/script.26d1b659.js"></script></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('>> main'); |
12 changes: 12 additions & 0 deletions
12
test/cases/_pug/resolve-js-css-multipage/src/styles/main.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
body { | ||
font-size: 18px; | ||
font-family: Arial, sans-serif; | ||
} | ||
|
||
h1 { | ||
color: deepskyblue; | ||
} | ||
|
||
h4 { | ||
color: #9f9f9f; | ||
} |
13 changes: 13 additions & 0 deletions
13
test/cases/_pug/resolve-js-css-multipage/src/views/layouts/default.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
doctype html | ||
html | ||
head | ||
title= title | ||
|
||
block style | ||
link(rel='stylesheet' href=require('@styles/main.css')) | ||
|
||
script(src=require('@scripts/main')) | ||
body | ||
h4 Default layout | ||
block content | ||
block script |
11 changes: 11 additions & 0 deletions
11
test/cases/_pug/resolve-js-css-multipage/src/views/pages/about/index.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends @views/layouts/default | ||
|
||
append script | ||
script(src='./script.js') | ||
|
||
append style | ||
link(rel='stylesheet' href=require('./style.css')) | ||
//-link(rel='stylesheet' href='./style.css') | ||
block content | ||
h1 About |
1 change: 1 addition & 0 deletions
1
test/cases/_pug/resolve-js-css-multipage/src/views/pages/about/script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('>> about'); |
3 changes: 3 additions & 0 deletions
3
test/cases/_pug/resolve-js-css-multipage/src/views/pages/about/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: seagreen; | ||
} |
8 changes: 8 additions & 0 deletions
8
test/cases/_pug/resolve-js-css-multipage/src/views/pages/index.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
extends @views/layouts/default | ||
|
||
append style | ||
|
||
append script | ||
|
||
block content | ||
h1 Start page |
11 changes: 11 additions & 0 deletions
11
test/cases/_pug/resolve-js-css-multipage/src/views/pages/news/index.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extends @views/layouts/default | ||
|
||
append script | ||
script(src='./script.js') | ||
|
||
append style | ||
link(rel='stylesheet' href=require('./style.css')) | ||
//-link(rel='stylesheet' href='./style.css') | ||
block content | ||
h1 News |
1 change: 1 addition & 0 deletions
1
test/cases/_pug/resolve-js-css-multipage/src/views/pages/news/script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('>> news'); |
3 changes: 3 additions & 0 deletions
3
test/cases/_pug/resolve-js-css-multipage/src/views/pages/news/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: orangered; | ||
} |
44 changes: 44 additions & 0 deletions
44
test/cases/_pug/resolve-js-css-multipage/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const path = require('path'); | ||
const HtmlBundlerPlugin = require('@test/html-bundler-webpack-plugin'); | ||
|
||
module.exports = { | ||
mode: 'production', | ||
|
||
output: { | ||
path: path.join(__dirname, 'dist/'), | ||
}, | ||
|
||
resolve: { | ||
alias: { | ||
'@views': path.join(__dirname, 'src/views'), | ||
'@styles': path.join(__dirname, 'src/styles'), | ||
'@scripts': path.join(__dirname, 'src/scripts'), | ||
}, | ||
}, | ||
|
||
plugins: [ | ||
new HtmlBundlerPlugin({ | ||
entry: { | ||
news: './src/views/pages/news/index.pug', | ||
about: './src/views/pages/about/index.pug', | ||
index: './src/views/pages/index.pug', | ||
}, | ||
js: { | ||
filename: 'js/[name].[contenthash:8].js', | ||
}, | ||
css: { | ||
filename: 'css/[name].[contenthash:8].css', | ||
}, | ||
preprocessor: 'pug', | ||
}), | ||
], | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(css)$/, | ||
use: ['css-loader'], | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters