WIP: transforming through handlebars, parsing the html and resolving the imports
This commit is contained in:
@@ -115,7 +115,7 @@ test.serial('template', async (t) => {
|
||||
input: 'batman.js',
|
||||
plugins: [
|
||||
html({
|
||||
template: () => '<html><body><main></main></body></html>'
|
||||
transform: () => '<html><body><main></main></body></html>'
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export const notSoIifi = ()=>{
|
||||
return `I'm "annoying" ${"in case we need to test \`string\` escaping.''"}`;
|
||||
}
|
||||
console.log(notSoIifi());
|
||||
|
||||
@@ -8,7 +8,7 @@ import { getCode } from "../util/test.js";
|
||||
import html from "../../src/index.ts";
|
||||
import handlebars from "handlebars";
|
||||
|
||||
const output = { dir: 'output', format: 'umd' };
|
||||
const output = { dir: 'output', format: 'es' };
|
||||
|
||||
import {readFile} from "node:fs/promises";
|
||||
import {fileURLToPath} from "node:url";
|
||||
@@ -18,11 +18,11 @@ process.chdir(join(__dirname, 'fixtures'));
|
||||
test.serial('handlebars', async (t) => {
|
||||
const template = await readFile('index.hbs', {encoding: "utf-8"});
|
||||
const bundle = await rollup({
|
||||
input: 'batman.js',
|
||||
input: 'index.hbs',
|
||||
plugins: [
|
||||
html({
|
||||
fileName: 'index.html',
|
||||
template(ctx){
|
||||
// Should we define an output template here?!
|
||||
transform(ctx){
|
||||
return handlebars.compile(template)({a:'a'})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user