Comments (2)
For others with the same problem, my temporary fix is to manually prefix the urls after the build.
// package.json
"build": "eleventy; node htmlbase.js"
// htmlbase.js
const fs = require('fs');
const path = require('path');
const htmlBasePlugin = require("@11ty/eleventy/src/Plugins/HtmlBasePlugin.js");
filter = null;
class EleventyConfig {
pathPrefix = "/sarl/"; // Prefix here
addFilter(name, func) { };
addTransform(name, func) { };
addAsyncFilter(name, func) {
filter = func;
}
}
htmlBasePlugin(new EleventyConfig());
function getHtmlFiles(directoryPath) {
const files = fs.readdirSync(directoryPath);
let htmlFiles = [];
files.forEach((file) => {
const filePath = path.join(directoryPath, file);
const fileStat = fs.statSync(filePath);
if (fileStat.isDirectory()) {
const subDirectoryFiles = getHtmlFiles(filePath);
htmlFiles = htmlFiles.concat(subDirectoryFiles);
} else if (path.extname(file) === '.html') {
htmlFiles.push(filePath);
}
});
return htmlFiles;
}
async function process(directory) {
const htmlFiles = getHtmlFiles(directory);
const promises = htmlFiles.map(async (htmlFile) => {
const html = fs.readFileSync(htmlFile, 'utf8');
const html_tx = await filter(html);
fs.writeFileSync(htmlFile, html_tx, 'utf8');
})
await Promise.all(promises);
}
process('_site');
from slinkity.
Related Issues (20)
- Many same js files after generating many pages with same Vue component HOT 5
- Is vite ran on eleventy.after ? HOT 5
- 11ty + Syntax Highlighter Vite Error HOT 1
- Use JS/TS files without shortcodes? HOT 2
- PostCSS Plugins on build. HOT 2
- Is it possible to import SCSS from a npm package? HOT 1
- vite script tag gets added to json HOT 1
- V1 and Github Documentation HOT 3
- Server options, https, liveReload, domDiff? HOT 1
- Production build fails in windows - vite.cjs - fast_glob.sync() - needs path normalized for this to work HOT 2
- Slinkity asset contains url encoded slashes which prevent loading HOT 2
- children props not passing in markdown HOT 1
- Hydrate a single component on a component page HOT 1
- CSS Module files not resolved in production build for components rendered as an island HOT 4
- Vite preview
- React: The above dynamic import cannot be analyzed by Vite. HOT 1
- TypeError: vite.createFilter is not a function
- [11ty] Objects are not valid as a React child HOT 1
- Multiple running slinkity projects tends to bug vite
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slinkity.