feat: changed various config files

This commit is contained in:
Laureηt 2021-10-07 18:31:51 +02:00
parent 7c0bc3c9ca
commit d0f61d0805
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
5 changed files with 2904 additions and 18 deletions

View file

@ -1,6 +1,3 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]

View file

@ -1,4 +1,5 @@
const pluginNavigation = require("@11ty/eleventy-navigation")
const htmlmin = require("html-minifier");
module.exports = function (eleventyConfig) {
@ -11,6 +12,22 @@ module.exports = function (eleventyConfig) {
"node_modules/chaffle/docs/chaffle.min.js": "javascript/chaffle.min.js",
});
if (process.env.ELEVENTY_ENV == 'prod') {
eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
if (outputPath && outputPath.endsWith(".html")) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true
});
return minified;
} else {
return content;
}
});
}
eleventyConfig.addShortcode("year", () => {
let year = new Date().getFullYear();
return year.toString();
@ -20,7 +37,9 @@ module.exports = function (eleventyConfig) {
dir: {
input: "pages"
},
pathPrefix: '/~fainsil/'
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
}
}
}

3
.gitignore vendored
View file

@ -2,5 +2,4 @@ node_modules/
_site/
pages/content/
package-lock.json
yarn.lock
*.log

View file

@ -1,13 +1,22 @@
{
"name": "personnal-website",
"version": "1.1.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-navigation": "^0.2.0"
},
"dependencies": {
"chaffle": "^2.1.0"
}
"name": "personnal-website",
"version": "1.1.0",
"author": "Laureηt <laurentfainsin@protonmail.com>",
"license": "MIT",
"scripts": {
"watch:sass": "sass --no-source-map --watch src/scss:_site/css",
"watch:eleventy": "ELEVENTY_ENV=dev eleventy --serve",
"build:sass": "sass --no-source-map src/scss:_site/css",
"build:eleventy": "ELEVENTY_ENV=prod eleventy",
"start": "npm-run-all build:sass --parallel watch:*",
"build": "npm-run-all build:sass build:eleventy"
},
"dependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-navigation": "^0.2.0",
"chaffle": "^2.1.0",
"html-minifier": "^4.0.0",
"npm-run-all": "^4.1.5",
"sass": "^1.42.1"
}
}

2862
yarn.lock Normal file

File diff suppressed because it is too large Load diff