-
Notifications
You must be signed in to change notification settings - Fork 23
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
1 changed file
with
23 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
module.exports = (gulp, config) => { | ||
return () => { | ||
const path = require('path'); | ||
const appName = require(path.join(config.projectDir, 'package.json')).name; | ||
const Builder = require('jspm').Builder; | ||
module.exports = (gulp, config) => () => { | ||
const path = require('path'); | ||
const Builder = require('jspm').Builder; | ||
const builder = new Builder(); | ||
|
||
return beginBuild() | ||
.then(buildSFX) | ||
.catch((err) => console.log('Build Failed', err)); | ||
|
||
function beginBuild() { | ||
builder.reset(); | ||
return builder.loadConfig(path.join(config.projectDir, 'jspm.conf.js')) | ||
} | ||
|
||
const builder = new Builder(); | ||
function buildSFX() { | ||
const appName = require(path.join(config.projectDir, 'package.json')).name; | ||
const distFileName = `${appName}.min.js`; | ||
const outFile = path.join(config.distDir, distFileName); | ||
const moduleName = 'app'; | ||
const buildConfig = { | ||
format: 'amd', | ||
minify: true, | ||
sourceMaps: true | ||
}; | ||
return builder.buildStatic(moduleName, outFile, buildConfig); | ||
} | ||
|
||
builder.reset(); | ||
builder.loadConfig(path.join(config.projectDir, 'jspm.conf.js')) | ||
.then(() => { | ||
const moduleName = 'app'; | ||
const buildConfig = { | ||
format: 'amd', | ||
minify: true, | ||
sourceMaps: true | ||
}; | ||
return builder.buildStatic(moduleName, outFile, buildConfig); | ||
}) | ||
.catch((err) => console.log('Build Failed', err)); | ||
}; | ||
}; | ||
|