Skip to content

Commit 6f16656

Browse files
committed
feat(gulp): lint xml listings
close #431
1 parent 1813edf commit 6f16656

File tree

3 files changed

+128
-2
lines changed

3 files changed

+128
-2
lines changed

Gulpfile.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ var paths = {
4444
},
4545
fonts: {
4646
output: 'src/main/xar-resources/resources/fonts/',
47-
}
47+
},
48+
listings: 'src/main/xar-resources/data/*/listings/*.xml'
4849
}
4950

5051
/**
@@ -85,6 +86,8 @@ var lazypipe = require('lazypipe')
8586
var rename = require('gulp-rename')
8687
var header = require('gulp-header')
8788
var pkg = require('./package.json')
89+
var prettyData = require('gulp-pretty-data')
90+
8891

8992
// Scripts
9093
var standard = require('gulp-standard')
@@ -193,6 +196,23 @@ var lintScripts = function(done) {
193196
done()
194197
}
195198

199+
// minify and lint xml
200+
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+
}))
211+
.pipe(dest("./"))
212+
// Signal completion
213+
done()
214+
}
215+
196216
// Process, lint, and minify Sass files
197217
var buildStyles = function(done) {
198218
// Make sure this feature is activated before running
@@ -327,6 +347,7 @@ exports.default = series(
327347
buildStyles,
328348
buildSVGs,
329349
copyFiles,
330-
buildPack
350+
buildPack,
351+
prettyXml
331352
)
332353
)

package-lock.json

Lines changed: 104 additions & 0 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"gulp-flatmap": "^1.0.2",
4141
"gulp-header": "^2.0.9",
4242
"gulp-optimize-js": "^1.1.0",
43+
"gulp-pretty-data": "^0.1.2",
4344
"gulp-rename": "^2.0.0",
4445
"gulp-sass": "^4.0.2",
4546
"gulp-sourcemaps": "^2.6.5",

0 commit comments

Comments
 (0)