refactored for a simpler docs gulp file with reuse of aggregates now that it is possible

This commit is contained in:
Kevin Ross 2016-03-18 12:20:01 -05:00
parent c03e48f023
commit 9e7986a78d

View File

@ -40,93 +40,100 @@ const prefix = {task: {prefix: 'docs:'}}
export default function (gulp, options) { export default function (gulp, options) {
let javascripts = parallel(gulp, const js = new Aggregate(gulp, 'js',
new RollupIife(gulp, preset, prefix, options.rollupConfig, { series(gulp,
options: { new EsLint(gulp, preset, prefix),
dest: 'docs.iife.js', parallel(gulp,
moduleName: 'docs' new RollupIife(gulp, preset, prefix, options.rollupConfig, {
} options: {
}), dest: 'docs.iife.js',
new Uglify(gulp, preset, prefix, { moduleName: 'docs'
task: {name: 'vendor:uglify'}, }
source: {options: {cwd: 'docs/assets/js/vendor'}}, }),
options: {dest: 'docs-vendor.min.js'} new Uglify(gulp, preset, prefix, {
}) task: {name: 'vendor:uglify'},
) source: {options: {cwd: 'docs/assets/js/vendor'}},
options: {dest: 'docs-vendor.min.js'}
})
)
),
prefix)
let eslint = new EsLint(gulp, preset, prefix) const css = new Aggregate(gulp, 'css',
let scsslint = new ScssLint(gulp, preset, prefix, { series(gulp,
source: {glob: ['**/*.scss', '!docs.scss']}, new ScssLint(gulp, preset, prefix, {
watch: {glob: ['**/*.scss', '!docs.scss']} source: {glob: ['**/*.scss', '!docs.scss']},
}) watch: {glob: ['**/*.scss', '!docs.scss']}
let linters = parallel(gulp, scsslint, eslint) }),
let sass = new Sass(gulp, preset, prefix) new Sass(gulp, preset, prefix),
new CssNano(gulp, preset, prefix)
),
prefix)
let recipes = series(gulp, const defaultRecipes = new Aggregate(gulp, 'default',
new Clean(gulp, preset, prefix), series(gulp,
linters, new Clean(gulp, preset, prefix),
sass, parallel(gulp,
javascripts, css,
new CssNano(gulp, preset, prefix) js
) )
),
new Aggregate(gulp, 'default', recipes, prefix) prefix)
new Aggregate(gulp, 'lint', linters, prefix)
new Aggregate(gulp, 'js', series(gulp, eslint, javascripts), prefix)
new Aggregate(gulp, 'css', series(gulp, scsslint, sass), prefix)
// docs copy // docs copy
new Aggregate(gulp, 'copy:bs-docs', parallel(gulp, new Aggregate(gulp, 'copy:bs-docs',
new Copy(gulp, preset, prefix, { parallel(gulp,
task: false, //{name: 'copy:bs-docs-content'}, new Copy(gulp, preset, prefix, {
source: { task: false, //{name: 'copy:bs-docs-content'},
options: {cwd: '../bootstrap/docs/content'}, source: {
glob: ['**/*'] options: {cwd: '../bootstrap/docs/content'},
}, glob: ['**/*']
dest: 'docs/content/', },
process: copyProcessor dest: 'docs/content/',
}), process: copyProcessor
new Copy(gulp, preset, prefix, { }),
task: false, //{name: 'copy:bs-docs-components'}, new Copy(gulp, preset, prefix, {
source: { task: false, //{name: 'copy:bs-docs-components'},
options: {cwd: '../bootstrap/docs/components'}, source: {
glob: ['**/*'] options: {cwd: '../bootstrap/docs/components'},
}, glob: ['**/*']
dest: 'docs/components/', },
process: copyProcessor dest: 'docs/components/',
}), process: copyProcessor
new Copy(gulp, preset, prefix, { }),
task: false, //{name: 'copy:bs-docs-scss'}, new Copy(gulp, preset, prefix, {
source: { task: false, //{name: 'copy:bs-docs-scss'},
options: {cwd: '../bootstrap/docs/assets/scss'}, source: {
glob: ['**/*', '!docs.scss'] // keep variable customizations options: {cwd: '../bootstrap/docs/assets/scss'},
}, glob: ['**/*', '!docs.scss'] // keep variable customizations
dest: 'docs/assets/scss/', },
process: (content, srcpath) => { dest: 'docs/assets/scss/',
return content.replace(/([\s\S]+)/mg, '// DO NOT EDIT IT WILL BE OVERWRITTEN - copy of bootstrap documentation generated by gulp docs:copy:bs-docs\n\n$1'); process: (content, srcpath) => {
} return content.replace(/([\s\S]+)/mg, '// DO NOT EDIT IT WILL BE OVERWRITTEN - copy of bootstrap documentation generated by gulp docs:copy:bs-docs\n\n$1');
}), }
new Copy(gulp, preset, prefix, { }),
task: false, //{name: 'copy:bs-docs-plugins'}, new Copy(gulp, preset, prefix, {
source: { task: false, //{name: 'copy:bs-docs-plugins'},
options: {cwd: '../bootstrap/docs/_plugins'}, source: {
glob: ['**/*', '!bridge.rb'] options: {cwd: '../bootstrap/docs/_plugins'},
}, glob: ['**/*', '!bridge.rb']
dest: 'docs/_plugins/' },
}), dest: 'docs/_plugins/'
new Copy(gulp, preset, prefix, { }),
task: false, //{name: 'copy:bs-docs-js-vendor'}, new Copy(gulp, preset, prefix, {
source: { task: false, //{name: 'copy:bs-docs-js-vendor'},
options: {cwd: '../bootstrap/docs/assets/js/vendor'}, source: {
glob: [ options: {cwd: '../bootstrap/docs/assets/js/vendor'},
'**/*', glob: [
'!tether.min.js', '**/*',
'!jquery.min.js' '!tether.min.js',
] '!jquery.min.js'
}, ]
dest: 'docs/assets/js/vendor/' },
}, prefix) dest: 'docs/assets/js/vendor/'
), prefix) }, prefix)
),
prefix)
return recipes return defaultRecipes
} }