-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
368 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
doctype html | ||
|
||
include ./includes/_helpers.pug | ||
|
||
html | ||
head | ||
title Test | ||
body | ||
+stylesheet('test') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { readFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import { format } from 'prettier'; | ||
import { plugin } from './../../../src/index'; | ||
|
||
describe('Issues', () => { | ||
test('should handle mixins', () => { | ||
const expected: string = readFileSync(resolve(__dirname, 'formatted.pug'), 'utf8'); | ||
const code: string = readFileSync(resolve(__dirname, 'unformatted.pug'), 'utf8'); | ||
const actual: string = format(code, { parser: 'pug' as any, plugins: [plugin] }); | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
doctype html | ||
|
||
include ./includes/_helpers.pug | ||
|
||
html | ||
head | ||
title Test | ||
body | ||
+stylesheet('test') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//- Declaration | ||
mixin list | ||
ul | ||
li foo | ||
li bar | ||
li baz | ||
//- Use | ||
+list | ||
+list | ||
|
||
.container | ||
.for | ||
.indentation | ||
mixin pet(name) | ||
li.pet= name | ||
ul | ||
+pet('cat') | ||
+pet('dog') | ||
+pet('pig') | ||
|
||
mixin article(title) | ||
.article | ||
.article-wrapper | ||
h1= title | ||
if block | ||
block | ||
else | ||
p No content provided | ||
|
||
+article('Hello world') | ||
|
||
+article('Hello world') | ||
p This is my | ||
p Amazing article | ||
|
||
mixin link(href, name) | ||
//- attributes == {class: "btn"} | ||
a(class!=attributes.class, href=href)= name | ||
|
||
+link('/foo', 'foo').btn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { readFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import { format } from 'prettier'; | ||
import { plugin } from './../../src/index'; | ||
|
||
describe('Mixins', () => { | ||
test('should handle mixins', () => { | ||
const expected: string = readFileSync(resolve(__dirname, 'formatted.pug'), 'utf8'); | ||
const code: string = readFileSync(resolve(__dirname, 'unformatted.pug'), 'utf8'); | ||
const actual: string = format(code, { parser: 'pug' as any, plugins: [plugin] }); | ||
|
||
expect(actual).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//- Declaration | ||
mixin list | ||
ul | ||
li foo | ||
li bar | ||
li baz | ||
//- Use | ||
+list | ||
+list | ||
|
||
.container | ||
.for | ||
.indentation | ||
mixin pet(name) | ||
li.pet= name | ||
ul | ||
+pet('cat') | ||
+pet('dog') | ||
+pet('pig') | ||
|
||
mixin article(title) | ||
.article | ||
.article-wrapper | ||
h1= title | ||
if block | ||
block | ||
else | ||
p No content provided | ||
|
||
+article('Hello world') | ||
|
||
+article('Hello world') | ||
p This is my | ||
p Amazing article | ||
|
||
mixin link(href, name) | ||
//- attributes == {class: "btn"} | ||
a(class!=attributes.class href=href)= name | ||
|
||
+link('/foo', 'foo')(class="btn") |
Oops, something went wrong.