Skip to content

Commit eacae3e

Browse files
shinnngucong3000
authored andcommitted
Apply postcss-xml to XML and XSLT files (#25)
Apply postcss-html to XML and XSLT files
1 parent fbd14ba commit eacae3e

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ const defaultConfig = {
3232
lang: "css",
3333
},
3434
{
35-
test: /\.(?:[sx]?html?|[sx]ht|vue|ux|markdown|md|php)$/i,
35+
// *.xslt? https://msdn.microsoft.com/en-us/library/ms764661(v=vs.85).aspx
36+
// *.vue https://vue-loader.vuejs.org/spec.html
37+
// *.ux https://doc.quickapp.cn/framework/source-file.html
38+
// `*.xml` Just for fault tolerance, XML is not supported except XSLT
39+
// `*.htm`, `*.*htm`
40+
// `*.html`, `*.*html`
41+
test: /\.(?:\w*html?|x(?:ht|ml|slt?)|markdown|md|php|vue|ux)$/i,
3642
extract: "html",
3743
},
3844
{

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-syntax",
3-
"version": "0.27.0",
3+
"version": "0.28.0",
44
"description": "Automatically switch PostCSS syntax by file extensions",
55
"repository": {
66
"type": "git",
@@ -39,10 +39,10 @@
3939
"mocha": "^5.2.0",
4040
"nyc": "^12.0.2",
4141
"postcss": "^6.0.22",
42-
"postcss-html": ">=0.27.0",
43-
"postcss-jsx": ">=0.27.0",
42+
"postcss-html": ">=0.28.0",
43+
"postcss-jsx": ">=0.28.0",
4444
"postcss-less": "^2.0.0",
45-
"postcss-markdown": ">=0.27.0",
45+
"postcss-markdown": ">=0.28.0",
4646
"postcss-safe-parser": "^3.0.1",
4747
"postcss-scss": "^1.0.5",
4848
"sugarss": "^1.0.1"

test/rules.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,30 @@ describe("default config rules", () => {
5252
it("foo.htm", () => {
5353
expect(getRule("foo.htm")).to.haveOwnProperty("extract", "html");
5454
});
55+
it("foo.shtml", () => {
56+
expect(getRule("foo.shtml")).to.haveOwnProperty("extract", "html");
57+
});
5558
it("foo.xht", () => {
5659
expect(getRule("foo.xht")).to.haveOwnProperty("extract", "html");
5760
});
58-
it("foo.shtml", () => {
59-
expect(getRule("foo.shtml")).to.haveOwnProperty("extract", "html");
61+
it("foo.xhtml", () => {
62+
expect(getRule("foo.xhtml")).to.haveOwnProperty("extract", "html");
63+
});
64+
it("foo.xml", () => {
65+
// Just for fault tolerance, XML is not supported except XSLT
66+
expect(getRule("foo.xml")).to.haveOwnProperty("extract", "html");
67+
});
68+
it("foo.xsl", () => {
69+
expect(getRule("foo.xsl")).to.haveOwnProperty("extract", "html");
70+
});
71+
it("foo.xslt", () => {
72+
expect(getRule("foo.xslt")).to.haveOwnProperty("extract", "html");
73+
});
74+
it("foo.vue", () => {
75+
expect(getRule("foo.vue")).to.haveOwnProperty("extract", "html");
76+
});
77+
it("foo.ux", () => {
78+
expect(getRule("foo.ux")).to.haveOwnProperty("extract", "html");
6079
});
6180
it("foo.php", () => {
6281
expect(getRule("foo.php")).to.haveOwnProperty("extract", "html");

0 commit comments

Comments
 (0)