Skip to content

Commit

Permalink
fix(eleventy): permalink: false をサポートする
Browse files Browse the repository at this point in the history
  • Loading branch information
chalkygames123 committed Mar 25, 2023
1 parent 19b1366 commit 382bfac
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
7 changes: 6 additions & 1 deletion 11ty/linters/lint-html.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const validator = new HtmlValidate(loader);
const formatter = formatterFactory('stylish');

const lintHtml = function (content) {
if (!['.html', '.php'].includes(extname(this.page.outputPath))) return;
if (
!this.page.outputPath ||
!['.html', '.php'].includes(extname(this.page.outputPath))
) {
return;
}

const report = validator.validateString(content, this.page.outputPath);

Expand Down
4 changes: 3 additions & 1 deletion 11ty/transforms/format-html.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ const isDevelopment = config.get('mode') !== 'production';

const formatHtml = async function (content) {
if (
!this.page.outputPath ||
!['.html', '.php'].includes(extname(this.page.outputPath)) ||
isDevelopment
)
) {
return content;
}

const options = await resolveConfig(this.page.outputPath, {
editorconfig: true,
Expand Down
4 changes: 3 additions & 1 deletion 11ty/transforms/minify-html.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ const isDevelopment = config.get('mode') !== 'production';

const minifyHtml = function (content) {
if (
!this.page.outputPath ||
!['.html', '.php'].includes(extname(this.page.outputPath)) ||
isDevelopment
)
) {
return content;
}

const result = minify(content, {
collapseBooleanAttributes: true,
Expand Down
6 changes: 5 additions & 1 deletion 11ty/transforms/set-image-dimensions.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ const setDimensions = (element, width, height) => {
};

const setImageDimensions = async function (content) {
if (!['.html', '.php'].includes(extname(this.page.outputPath)))
if (
!this.page.outputPath ||
!['.html', '.php'].includes(extname(this.page.outputPath))
) {
return content;
}

const dom = new JSDOM(content);
const {
Expand Down

0 comments on commit 382bfac

Please sign in to comment.