Verketten von Dateien mit npm als build-tool

Vor kurzem habe ich entdeckt, dass ich kann verwenden npm als ein task-runner anstelle von gulp oder grunt, alles ist fantastisch, so weit (lint, stylus, jade, verunstalten, Uhr .. etc) aber die Verkettung Teil, ich kann nicht scheinen zu erreichen. Mit schlucken war es so etwas wie:

gulp.task('scripts', function() {
  return gulp.src('www/js/**/*.js')
    .pipe(concat('all.js'))
    .pipe(gulp.dest('www/dist'))
    .pipe(rename('all.min.js'))
    .pipe(uglify())
    .pipe(gulp.dest('www/dist'));
});

Gibt es eine Möglichkeit, die ich tun kann, dass mit npm?

Mehr klar, mein Ziel ist es, so etwas zu tun:

//Paket.json

{
  "name": "f_todo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "concat": "^1.0.0",
    "rerun-script": "^0.6.0",
    "stylus": "^0.53.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "stylus": "stylus ss --compress --out lib/stylesheets",
    "concat": "concat dependency code would be here",
    "dev": "rerun-script"
  },
  "watches": {
    "stylus": "ss/**"
  }
}
  • Haben Sie versucht, Blick auf die concat Paket, wo Sie mit inspiration?
  • Ja, aber ich brauche so etwas wie concat js/** --out all.js in meinem Paket.json scripts-Objekt
InformationsquelleAutor Web Dev T | 2016-01-28
Schreibe einen Kommentar