在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):slushjs/slush开源软件地址(OpenSource Url):https://github.com/slushjs/slush开源编程语言(OpenSource Language):JavaScript 87.2%开源软件介绍(OpenSource Introduction):slush
Use Gulp instead of YeomanSlush is a tool to be able to use Gulp for project scaffolding. Slush does not contain anything "out of the box", except the ability to locate installed slush generators
and to run them with To be able to provide functionality like Yeoman, see: Yeoman like behavior below. InstallInstall npm install -g slush Usageslush <generator>[:<tasks>] [<args>]
Example: slush angular:component myNewComponent Which will run task List available generatorsIf run without any arguments, slush will list all installed generators. slush List available tasks in generatorTo list available tasks within a generator, use the generator name in conjunction with the slush <generator> --tasks Print version(s)As usual you can use slush -v It can also be used together with a generator name: slush <generator> -v You'll then get the version for slush, the gulp version installed in the generator and the version number of the given generator. Find slush generatorsCreating a generatorA Slush generator is an npm package following the naming convention Add As when building gulp plugins all slush generators need to have All Note remember to add gulp plugins (and gulp itself) as ordinary dependencies, instead of devDependencies, when building a slush generator. DocumentationThings to rememberWhen using Slush globally:
When using Slush locally:
When creating slush generators:
Slush uses gulpSlush is just the global excutable to trigger slush generators, under the hood it's still gulp that is run using each slushfile as config file. Needing help writing slush generators? Check out Gulp's documentation! The slushfileA slushfile is basically a gulpfile, but meant to be used to scaffold project structures. Why not name it "gulpfile" then?Because a Slush generator may want to use gulp locally for linting, testing and other purposes, in which case it will need to have a gulpfile. Sample slushfileGiven a slush generator project structure with a web app project template inside var gulp = require('gulp'),
install = require('gulp-install'),
conflict = require('gulp-conflict'),
template = require('gulp-template'),
inquirer = require('inquirer');
gulp.task('default', function (done) {
inquirer.prompt([
{type: 'input', name: 'name', message: 'Give your app a name', default: gulp.args.join(' ')}, // Get app name from arguments by default
{type: 'confirm', name: 'moveon', message: 'Continue?'}
],
function (answers) {
if (!answers.moveon) {
return done();
}
gulp.src(__dirname + '/templates/app/**') // Note use of __dirname to be relative to generator
.pipe(template(answers)) // Lodash template support
.pipe(conflict('./')) // Confirms overwrites on file conflicts
.pipe(gulp.dest('./')) // Without __dirname here = relative to cwd
.pipe(install()) // Run `bower install` and/or `npm install` if necessary
.on('end', function () {
done(); // Finished!
})
.resume();
});
}); Yeoman like behaviorUse these packages/plugins:
Want to contribute?Anyone can help make this project better! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论