mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-22 09:36:55 +03:00
refactored for a simpler docs gulp file with reuse of aggregates now that it is possible
This commit is contained in:
parent
c03e48f023
commit
9e7986a78d
175
gulp-docs.js
175
gulp-docs.js
|
@ -40,93 +40,100 @@ const prefix = {task: {prefix: 'docs:'}}
|
|||
|
||||
export default function (gulp, options) {
|
||||
|
||||
let javascripts = parallel(gulp,
|
||||
new RollupIife(gulp, preset, prefix, options.rollupConfig, {
|
||||
options: {
|
||||
dest: 'docs.iife.js',
|
||||
moduleName: 'docs'
|
||||
}
|
||||
}),
|
||||
new Uglify(gulp, preset, prefix, {
|
||||
task: {name: 'vendor:uglify'},
|
||||
source: {options: {cwd: 'docs/assets/js/vendor'}},
|
||||
options: {dest: 'docs-vendor.min.js'}
|
||||
})
|
||||
)
|
||||
const js = new Aggregate(gulp, 'js',
|
||||
series(gulp,
|
||||
new EsLint(gulp, preset, prefix),
|
||||
parallel(gulp,
|
||||
new RollupIife(gulp, preset, prefix, options.rollupConfig, {
|
||||
options: {
|
||||
dest: 'docs.iife.js',
|
||||
moduleName: 'docs'
|
||||
}
|
||||
}),
|
||||
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)
|
||||
let scsslint = new ScssLint(gulp, preset, prefix, {
|
||||
source: {glob: ['**/*.scss', '!docs.scss']},
|
||||
watch: {glob: ['**/*.scss', '!docs.scss']}
|
||||
})
|
||||
let linters = parallel(gulp, scsslint, eslint)
|
||||
let sass = new Sass(gulp, preset, prefix)
|
||||
const css = new Aggregate(gulp, 'css',
|
||||
series(gulp,
|
||||
new ScssLint(gulp, preset, prefix, {
|
||||
source: {glob: ['**/*.scss', '!docs.scss']},
|
||||
watch: {glob: ['**/*.scss', '!docs.scss']}
|
||||
}),
|
||||
new Sass(gulp, preset, prefix),
|
||||
new CssNano(gulp, preset, prefix)
|
||||
),
|
||||
prefix)
|
||||
|
||||
let recipes = series(gulp,
|
||||
new Clean(gulp, preset, prefix),
|
||||
linters,
|
||||
sass,
|
||||
javascripts,
|
||||
new CssNano(gulp, preset, prefix)
|
||||
)
|
||||
|
||||
new Aggregate(gulp, 'default', recipes, 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)
|
||||
const defaultRecipes = new Aggregate(gulp, 'default',
|
||||
series(gulp,
|
||||
new Clean(gulp, preset, prefix),
|
||||
parallel(gulp,
|
||||
css,
|
||||
js
|
||||
)
|
||||
),
|
||||
prefix)
|
||||
|
||||
// docs copy
|
||||
new Aggregate(gulp, 'copy:bs-docs', parallel(gulp,
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-content'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/content'},
|
||||
glob: ['**/*']
|
||||
},
|
||||
dest: 'docs/content/',
|
||||
process: copyProcessor
|
||||
}),
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-components'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/components'},
|
||||
glob: ['**/*']
|
||||
},
|
||||
dest: 'docs/components/',
|
||||
process: copyProcessor
|
||||
}),
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-scss'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/assets/scss'},
|
||||
glob: ['**/*', '!docs.scss'] // keep variable customizations
|
||||
},
|
||||
dest: 'docs/assets/scss/',
|
||||
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'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/_plugins'},
|
||||
glob: ['**/*', '!bridge.rb']
|
||||
},
|
||||
dest: 'docs/_plugins/'
|
||||
}),
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-js-vendor'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/assets/js/vendor'},
|
||||
glob: [
|
||||
'**/*',
|
||||
'!tether.min.js',
|
||||
'!jquery.min.js'
|
||||
]
|
||||
},
|
||||
dest: 'docs/assets/js/vendor/'
|
||||
}, prefix)
|
||||
), prefix)
|
||||
new Aggregate(gulp, 'copy:bs-docs',
|
||||
parallel(gulp,
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-content'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/content'},
|
||||
glob: ['**/*']
|
||||
},
|
||||
dest: 'docs/content/',
|
||||
process: copyProcessor
|
||||
}),
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-components'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/components'},
|
||||
glob: ['**/*']
|
||||
},
|
||||
dest: 'docs/components/',
|
||||
process: copyProcessor
|
||||
}),
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-scss'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/assets/scss'},
|
||||
glob: ['**/*', '!docs.scss'] // keep variable customizations
|
||||
},
|
||||
dest: 'docs/assets/scss/',
|
||||
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'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/_plugins'},
|
||||
glob: ['**/*', '!bridge.rb']
|
||||
},
|
||||
dest: 'docs/_plugins/'
|
||||
}),
|
||||
new Copy(gulp, preset, prefix, {
|
||||
task: false, //{name: 'copy:bs-docs-js-vendor'},
|
||||
source: {
|
||||
options: {cwd: '../bootstrap/docs/assets/js/vendor'},
|
||||
glob: [
|
||||
'**/*',
|
||||
'!tether.min.js',
|
||||
'!jquery.min.js'
|
||||
]
|
||||
},
|
||||
dest: 'docs/assets/js/vendor/'
|
||||
}, prefix)
|
||||
),
|
||||
prefix)
|
||||
|
||||
return recipes
|
||||
return defaultRecipes
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user