2017-10-12 1 views
0

Ich weiß, dass dies eine sehr dumme Frage sein kann, aber ich kann nicht Matches mit anderen Beiträgen auf Stackoverflow finden ...Lokale Änderungen in node_modules Datei (Angular 2)

Also: Kann ich eine Datei ändern von einem externen Modul, einfach die Datei speichern und etwas tun, das meine App hören kann?

Im Moment versuche ich einige scss-Stil auf dem ng2-datepicker-Modul (im Ordner node_modules) zu ändern, aber wenn ich speichern und den Start ng dienen, werden Änderungen keine Auswirkungen auf mein Projekt.

Ich weiß, es ist ein einfaches Problem, aber ich kenne nicht die Hintergrundarchitektur eines Angular2-Projekts.

Vielen Dank im Voraus.

(ps ich gesehen habe, dass ich die git gabeln und dann so etwas wie npm installieren. Sehr interessant, aber ich möchte auch wissen, wie das gleiche Ergebnis in lokalen haben)

Antwort

1

Wenn Sie mit schluck Datei, die Sie die geänderte lib Dateipfad kann sagen, kopieren Ordner Scheck gulp.task (‚copy-libs‘) in Code unten git repo for angular2-tour-of-heroes using gulp

const gulp = require('gulp'); 
const del = require('del'); 
const typescript = require('gulp-typescript'); 
const tscConfig = require('./tsconfig.json'); 
const sourcemaps = require('gulp-sourcemaps'); 
const tslint = require('gulp-tslint'); 
const browserSync = require('browser-sync'); 
const reload = browserSync.reload; 
const tsconfig = require('tsconfig-glob'); 

// clean the contents of the distribution directory 
gulp.task('clean', function() { 
    return del('dist/**/*'); 
}); 

// copy static assets - i.e. non TypeScript compiled source 
gulp.task('copy:assets', ['clean'], function() { 
    return gulp.src(['app/**/*', 'index.html', 'styles.css', '!app/**/*.ts'], { base : './' }) 
    .pipe(gulp.dest('dist')) 
}); 

// copy dependencies 
gulp.task('copy:libs', ['clean'], function() { 
    return gulp.src([ 
     'node_modules/angular2/bundles/angular2-polyfills.js', 
     'node_modules/systemjs/dist/system.src.js', 
     'node_modules/rxjs/bundles/Rx.js', 
     'node_modules/angular2/bundles/angular2.dev.js', 
     'node_modules/angular2/bundles/router.dev.js', 
     'node_modules/node-uuid/uuid.js', 
     'node_modules/immutable/dist/immutable.js' 
     'yourpath/changedFileName.js' 
    ]) 
    .pipe(gulp.dest('dist/lib')) 
}); 

// linting 
gulp.task('tslint', function() { 
    return gulp.src('app/**/*.ts') 
    .pipe(tslint()) 
    .pipe(tslint.report('verbose')); 
}); 


// TypeScript compile 
gulp.task('compile', ['clean'], function() { 
    return gulp 
    .src(tscConfig.files) 
    .pipe(sourcemaps.init()) 
    .pipe(typescript(tscConfig.compilerOptions)) 
    .pipe(sourcemaps.write('.')) 
    .pipe(gulp.dest('dist/app')); 
}); 

// update the tsconfig files based on the glob pattern 
gulp.task('tsconfig-glob', function() { 
    return tsconfig({ 
    configPath: '.', 
    indent: 2 
    }); 
}); 

// Run browsersync for development 
gulp.task('serve', ['build'], function() { 
    browserSync({ 
    server: { 
     baseDir: 'dist' 
    } 
    }); 

    gulp.watch(['app/**/*', 'index.html', 'styles.css'], ['buildAndReload']); 
}); 

gulp.task('build', ['tslint', 'compile', 'copy:libs', 'copy:assets']); 
gulp.task('buildAndReload', ['build'], reload); 
gulp.task('default', ['build']); 
+0

ich nie verwendet, aber schluck i'ts sehr interessant zu bauen. Scheint ein wenig kompliziert für lokale Änderungen, aber ich werde es installieren! – Tommolo

Verwandte Themen