Skip to content

Commit

Permalink
Add support for including javascript-files with uglify-js
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
nknapp committed Dec 18, 2016
1 parent a656929 commit c8fe6b5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var yaml = require('js-yaml')
module.exports = customize()
.registerEngine('handlebars', require('customize-engine-handlebars'))
.registerEngine('less', require('customize-engine-less'))
.registerEngine('uglify', require('customize-engine-uglify'))

// Customize type for adding methods
var Customize = customize.Customize
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"commander": "^2.6.0",
"customize-engine-handlebars": "<1.0.0",
"customize-engine-less": "<1.0.0",
"customize-engine-uglify": "<1.0.0",
"customize-watch": "<1.0.0",
"customize-write-files": "<1.0.0",
"debug": "^2.1.2",
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/lib1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('lib1')
6 changes: 6 additions & 0 deletions test/fixtures/test-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ module.exports = function (builder) {
},
less: {
main: require.resolve('./main.less')
},
uglify: {
files: {
'lib1.js': require.resolve('./lib1.js')
}
}

})
}
8 changes: 8 additions & 0 deletions test/main-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ function run () {
},
less: {
main: require.resolve('./fixtures/main.less')
},
uglify: {
files: {
'lib1.js': require.resolve('./fixtures/lib1.js')
}
}
})
.build(swaggerJsonFile, targetDir)
Expand Down Expand Up @@ -114,6 +119,9 @@ describe('The CLI interface', function () {
expect(result.err).to.be.null
expect(outputFile('index.html'), 'Checking index.html').to.equal('eins=ichi zwei=ni drei=san')
expect(outputFile('main.css'), 'Checking main.css').to.equal("body{background-color:'#abc'}")
expect(outputFile('main.css.map'), 'Source map main.css.map must exist').to.be.ok
expect(outputFile('bundle.js'), 'Checking bundle.js').to.equal('console.log("lib1");\n//# sourceMappingURL=bundle.js.map')
expect(outputFile('bundle.js.map'), 'Source map bundle.js.map must exist').to.be.ok
})
})

Expand Down

0 comments on commit c8fe6b5

Please sign in to comment.