-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: refactor test cases for preprocessor
- Loading branch information
Showing
394 changed files
with
315 additions
and
363 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
test/cases/_preprocessor/ejs-option-async/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,53 @@ | ||
const path = require('path'); | ||
const HtmlBundlerPlugin = require('@test/html-bundler-webpack-plugin'); | ||
const ejs = require('ejs'); | ||
|
||
module.exports = { | ||
mode: 'production', | ||
|
||
output: { | ||
path: path.join(__dirname, 'dist/'), | ||
}, | ||
|
||
resolve: { | ||
alias: { | ||
'@images': path.join(__dirname, '../../../fixtures/images'), | ||
}, | ||
}, | ||
|
||
plugins: [ | ||
new HtmlBundlerPlugin({ | ||
test: /\.(html|ejs)$/, | ||
entry: { | ||
index: { | ||
import: './src/home.ejs', | ||
data: { | ||
title: 'Home', | ||
headline: 'Breaking Bad', | ||
people: ['Walter White', 'Jesse Pinkman'], | ||
}, | ||
}, | ||
}, | ||
|
||
// use custom function which return promise | ||
//preprocessor: (content, { rootContext: root, data }) => ejs.render(content, data, { root, async: true }), | ||
|
||
preprocessor: 'ejs', | ||
preprocessorOptions: { | ||
async: true, | ||
}, | ||
}), | ||
], | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(png|svg|jpe?g|webp)$/i, | ||
type: 'asset/resource', | ||
generator: { | ||
filename: 'assets/img/[name].[hash:8][ext]', | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...cessor-handlebars-runtime/expected/app.js → ...handlebars-custom-runtime/expected/app.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
test/cases/_preprocessor/handlebars-option-partials-object/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,59 @@ | ||
const path = require('path'); | ||
const HtmlBundlerPlugin = require('@test/html-bundler-webpack-plugin'); | ||
|
||
module.exports = { | ||
mode: 'production', | ||
|
||
output: { | ||
path: path.join(__dirname, 'dist/'), | ||
}, | ||
|
||
resolve: { | ||
alias: { | ||
'@images': path.join(__dirname, '../../../fixtures/images'), | ||
}, | ||
}, | ||
|
||
plugins: [ | ||
new HtmlBundlerPlugin({ | ||
entry: { | ||
index: { | ||
import: './src/views/pages/home.hbs', | ||
data: { | ||
title: 'Home', | ||
headline: 'Breaking Bad', | ||
people: ['Walter White', 'Jesse Pinkman'], | ||
}, | ||
}, | ||
}, | ||
|
||
preprocessor: 'handlebars', | ||
preprocessorOptions: { | ||
// define partials manually | ||
partials: { | ||
gallery: path.join(__dirname, 'src/views/includes/gallery.html'), | ||
teaser: path.join(__dirname, 'src/views/includes/teaser.hbs'), | ||
header: path.join(__dirname, 'src/views/partials/header.html'), | ||
footer: path.join(__dirname, 'src/views/partials/footer.html'), | ||
'menu/nav': path.join(__dirname, 'src/views/partials/menu/nav.html'), | ||
'menu/aside/left': path.join(__dirname, 'src/views/partials/menu/aside/left.html'), | ||
'menu/aside/right': path.join(__dirname, 'src/views/partials/menu/aside/right.hbs'), | ||
'menu/top/desktop': path.join(__dirname, 'src/views/partials/menu/top/desktop.html'), | ||
'menu/top/mobile': path.join(__dirname, 'src/views/partials/menu/top/mobile.hbs'), | ||
}, | ||
}, | ||
}), | ||
], | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(png|svg|jpe?g|webp)$/i, | ||
type: 'asset/resource', | ||
generator: { | ||
filename: 'assets/img/[name].[hash:8][ext]', | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.