updated sorting system and added linting
This commit is contained in:
parent
2d33c28f6b
commit
116eb3c867
38
.eleventy.js
38
.eleventy.js
|
@ -9,7 +9,7 @@ module.exports = (config) => {
|
||||||
for (let page of pages) {
|
for (let page of pages) {
|
||||||
if (page.data.sort) {
|
if (page.data.sort) {
|
||||||
if (sorted[page.data.sort]) {
|
if (sorted[page.data.sort]) {
|
||||||
sorted.splice(page.data.sort)
|
sorted.splice(page.data.sort, 0, page)
|
||||||
} else {
|
} else {
|
||||||
sorted[page.data.sort] = page
|
sorted[page.data.sort] = page
|
||||||
}
|
}
|
||||||
|
@ -21,25 +21,25 @@ module.exports = (config) => {
|
||||||
return sorted.concat(unsorted)
|
return sorted.concat(unsorted)
|
||||||
})
|
})
|
||||||
|
|
||||||
// custom filters
|
// custom filters
|
||||||
config.addFilter("makeLowercase", (value) => {
|
config.addFilter("makeLowercase", (value) => {
|
||||||
if (typeof value === 'string' || value instanceof String) {
|
if (typeof value === 'string' || value instanceof String) {
|
||||||
return value.toLowerCase()
|
return value.toLowerCase()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// added passthrough for global assets
|
// added passthrough for global assets
|
||||||
config.addPassthroughCopy("assets")
|
config.addPassthroughCopy("assets")
|
||||||
// added passthrough for images in their respective folders
|
// added passthrough for images in their respective folders
|
||||||
config.addPassthroughCopy("_content/**/images/**")
|
config.addPassthroughCopy("_content/**/images/**")
|
||||||
|
|
||||||
// reutrn updated config
|
// reutrn updated config
|
||||||
return {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
input: "_content", // content
|
input: "_content", // content
|
||||||
includes: "../_includes", // templates
|
includes: "../_includes", // templates
|
||||||
output: "_site", // rendered site
|
output: "_site", // rendered site
|
||||||
data: "../_data" // global data files
|
data: "../_data" // global data files
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true,
|
||||||
|
"es2021": false,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-var": "error",
|
||||||
|
"semi": ["error", "never"],
|
||||||
|
"quotes": ["error", "single"],
|
||||||
|
"indent": ["error", 2],
|
||||||
|
"arrow-spacing": "error",
|
||||||
|
"array-bracket-spacing": ["error", "always"],
|
||||||
|
"array-bracket-newline": ["error", "consistent"],
|
||||||
|
"object-curly-spacing": ["error", "always"],
|
||||||
|
"object-curly-newline": ["error", { "consistent": true }],
|
||||||
|
"space-before-blocks": ["error", "always"]
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["./assets/**/*.js"],
|
||||||
|
"env": {
|
||||||
|
"commonjs": false,
|
||||||
|
"node": false
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue