2016-03-24 18 views
0

İyonik çerçeve ile çalışıyorum ve daha iyi performans için açısal templatecache ekleyin, sass ve gulp kullanarak üretin. Eylemde bu benim için çalıştı Ama ben iyonik gulp üretmek/orijinal ionic.app.css değiştirdim hizmet ve Ben ionic.app.css değiştiremiyorum. benim edited ionic.app.css ve daha sonra ionic serve düzenlenmiş benim düzenleme ve orijinal ionic.app.css dosyaya değiştirilmiş/değiştirir düzenlenir.Gulp, ionic.app.css işlevini iyonik olarak değiştirdi

ionic serve 
Gulp startup tasks: 0=sass, 1=templatecache, 2=watch 
Running live reload server: undefined 
Watching: 0=www/**/*, 1=!www/lib/**/* 
Running dev server: http://localhost:8100 
Ionic server commands, enter: 
    restart or r to restart the client app from the root 
    goto or g and a url to have the app navigate to the given url 
    consolelogs or c to enable/disable console log output 
    serverlogs or s to enable/disable server log output 
    quit or q to shutdown the server and exit 

ionic $ [22:15:54] Using gulpfile ~\Desktop\app\gulpfile.js 
[22:15:54] Starting 'sass'... 
[22:15:54] Starting 'templatecache'... 
[22:15:54] Starting 'watch'... 
[22:15:54] Finished 'watch' after 74 ms 
[22:15:54] Finished 'templatecache' after 172 ms 
JS changed: C:\Users\Mobi\Desktop\app\www\js\views.js 
[22:15:55] Finished 'sass' after 1.26 s 
CSS changed: C:\Users\Mobi\Desktop\app\www\css\ionic.app.css 

gulpfile:

var gulp = require('gulp'); 

var requireDir = require('require-dir'); 
requireDir('./gulp-tasks'); 

gulp.task('default', ['sass', 'templatecache']); 

gulptask.js:

var gulp = require('gulp'); 
var gutil = require('gulp-util'); 
var bower = require('bower'); 
var sass = require('gulp-sass'); 
var sh = require('shelljs'); 

var sourcemaps = require('gulp-sourcemaps'); 
var templateCache = require('gulp-angular-templatecache'); 

var paths = { 
    sass: ['./scss/**/*.scss'], 
    templatecache: ['./www/views/**/*.html'] 
}; 

gulp.task('sass', function(done) { 
    gulp.src('./scss/ionic.app.scss') 
    .pipe(sourcemaps.init()) 
    .pipe(sass({ 
     errLogToConsole: true 
    })) 
    .pipe(sourcemaps.write()) 
    .pipe(gulp.dest('./www/css/')) 
    .on('end', done); 
}); 

gulp.task('templatecache', function (done) { 
    gulp.src(paths.templatecache) 
    .pipe(templateCache({standalone:true, filename:'views.js', module:'your_app_name.views', root:'views/'})) 
    .pipe(gulp.dest('./www/js/')) 
    .on('end', done); 
}); 

gulp.task('watch', function() { 
    gulp.watch(paths.sass, ['sass']); 
    gulp.watch(paths.templatecache, ['templatecache']); 
}); 

gulp.task('install', ['git-check'], function() { 
    return bower.commands.install() 
    .on('log', function(data) { 
     gutil.log('bower', gutil.colors.cyan(data.id), data.message); 
    }); 
}); 

gulp.task('git-check', function(done) { 
    if (!sh.which('git')) { 
    console.log(
     ' ' + gutil.colors.red('Git is not installed.'), 
     '\n Git, the version control system, is required to download Ionic.', 
     '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', 
     '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' 
    ); 
    process.exit(1); 
    } 
    done(); 
}); 

nasıl Bu sorunu düzelt do ?!

cevap

0

Açısal şablon önbelleğiyle aşina değilim, ancak Sass bir İyonik uygulamada etkinleştirildiğinde bu normal davranıştır. o etkinleştirildiğinde

, sen iyonik hizmet sırasında /scss/ionic.app.scss

yılında CSS değişiklikleri yapmak gerekiyor, ionic.app.scss böylece ionic.app.css derlenmiş olacak Bu dosyada yaptığınız değişiklikleri kaldırır. Eğer Sass kullanmak istemiyorsanız burada anlatıldığı gibi

, sen ionic.project dosyasından çıkararak belirli Gulp görevleri çalışmasını durdurmak yapabilirsiniz: https://forum.ionicframework.com/t/can-you-uninstall-or-remove-or-disable-sass/31848