feat: changed various config files
This commit is contained in:
parent
7c0bc3c9ca
commit
d0f61d0805
|
@ -1,6 +1,3 @@
|
||||||
# EditorConfig is awesome: https://EditorConfig.org
|
|
||||||
|
|
||||||
# top-most EditorConfig file
|
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
|
|
21
.eleventy.js
21
.eleventy.js
|
@ -1,4 +1,5 @@
|
||||||
const pluginNavigation = require("@11ty/eleventy-navigation")
|
const pluginNavigation = require("@11ty/eleventy-navigation")
|
||||||
|
const htmlmin = require("html-minifier");
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
|
|
||||||
|
@ -11,6 +12,22 @@ module.exports = function (eleventyConfig) {
|
||||||
"node_modules/chaffle/docs/chaffle.min.js": "javascript/chaffle.min.js",
|
"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", () => {
|
eleventyConfig.addShortcode("year", () => {
|
||||||
let year = new Date().getFullYear();
|
let year = new Date().getFullYear();
|
||||||
return year.toString();
|
return year.toString();
|
||||||
|
@ -20,7 +37,9 @@ module.exports = function (eleventyConfig) {
|
||||||
dir: {
|
dir: {
|
||||||
input: "pages"
|
input: "pages"
|
||||||
},
|
},
|
||||||
pathPrefix: '/~fainsil/'
|
dataTemplateEngine: 'njk',
|
||||||
|
htmlTemplateEngine: 'njk',
|
||||||
|
markdownTemplateEngine: 'njk',
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,5 +2,4 @@ node_modules/
|
||||||
_site/
|
_site/
|
||||||
pages/content/
|
pages/content/
|
||||||
|
|
||||||
package-lock.json
|
*.log
|
||||||
yarn.lock
|
|
||||||
|
|
19
package.json
19
package.json
|
@ -1,13 +1,22 @@
|
||||||
{
|
{
|
||||||
"name": "personnal-website",
|
"name": "personnal-website",
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"main": "index.js",
|
"author": "Laureηt <laurentfainsin@protonmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"scripts": {
|
||||||
"@11ty/eleventy": "^0.12.1",
|
"watch:sass": "sass --no-source-map --watch src/scss:_site/css",
|
||||||
"@11ty/eleventy-navigation": "^0.2.0"
|
"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": {
|
"dependencies": {
|
||||||
"chaffle": "^2.1.0"
|
"@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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue