Skip to content

Commit 8988ba6

Browse files
committed
fix(gulp): switch xml lint library
see #431
1 parent 09c39d6 commit 8988ba6

File tree

3 files changed

+120
-111
lines changed

3 files changed

+120
-111
lines changed

Gulpfile.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ var paths = {
4343
output: 'src/main/xar-resources/resources/'
4444
},
4545
fonts: {
46-
output: 'src/main/xar-resources/resources/fonts/',
46+
output: 'src/main/xar-resources/resources/fonts/'
4747
},
48-
listings: 'src/main/xar-resources/data/*/listings/*.xml'
48+
xml: {
49+
listings: 'src/main/xar-resources/data/*/listings/*.xml',
50+
articles: 'src/main/xar-resources/data/*/*.xml'
51+
}
4952
}
5053

5154
/**
@@ -86,7 +89,7 @@ var lazypipe = require('lazypipe')
8689
var rename = require('gulp-rename')
8790
var header = require('gulp-header')
8891
var pkg = require('./package.json')
89-
var prettyData = require('gulp-pretty-data')
92+
var muxml = require('gulp-muxml')
9093

9194

9295
// Scripts
@@ -196,18 +199,19 @@ var lintScripts = function(done) {
196199
done()
197200
}
198201

199-
// minify and lint xml
202+
// pretty print all xml listings
203+
// articles not yet decided
200204
var prettyXml = function(done) {
201-
src(paths.listings, { base: "./" })
202-
.pipe(prettyData({
203-
type: 'minify',
204-
preserveComments: true
205-
}))
206-
// … then pretty print xml
207-
.pipe(prettyData({
208-
type: 'prettify',
209-
preserveComments: true
210-
}))
205+
src(paths.xml.listings, { base: "./" })
206+
.pipe(muxml({
207+
stripComments: false,
208+
stripCdata: false,
209+
stripInstruction: false,
210+
saxOptions: {
211+
trim: true,
212+
normalize: true
213+
}
214+
}))
211215
.pipe(dest("./"))
212216
// Signal completion
213217
done()

package-lock.json

Lines changed: 101 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"gulp-cssnano": "^2.1.3",
4040
"gulp-flatmap": "^1.0.2",
4141
"gulp-header": "^2.0.9",
42+
"gulp-muxml": "^2.0.0",
4243
"gulp-optimize-js": "^1.1.0",
43-
"gulp-pretty-data": "^0.1.2",
4444
"gulp-rename": "^2.0.0",
4545
"gulp-sass": "^4.0.2",
4646
"gulp-sourcemaps": "^2.6.5",

0 commit comments

Comments
 (0)