mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
cordova css
This commit is contained in:
231
gulpfile.js
231
gulpfile.js
@ -71,7 +71,7 @@ gulp.task('watch', function() {
|
||||
gulp.start('examples');
|
||||
});
|
||||
|
||||
watch('ionic/components/**/*.scss', function() {
|
||||
watch('ionic/**/*.scss', function() {
|
||||
gulp.start('sass');
|
||||
});
|
||||
})
|
||||
@ -303,232 +303,3 @@ gulp.task('e2e', ['sass'], function() {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
gulp.task('old.build', function() {
|
||||
runSequence(
|
||||
'old.clean',
|
||||
'old.ionic.copy.js',
|
||||
'old.ionic.examples',
|
||||
'old.sass',
|
||||
'old.fonts',
|
||||
'old.vendor');
|
||||
})
|
||||
|
||||
gulp.task('old.watch', function() {
|
||||
|
||||
runSequence(
|
||||
'old.clean',
|
||||
'old.ionic.copy.js',
|
||||
'old.ionic.examples',
|
||||
'old.sass',
|
||||
'old.fonts',
|
||||
'old.vendor',
|
||||
|
||||
function() {
|
||||
watch('ionic/**/*.js', function(file) {
|
||||
var splt = file.path.split('/');
|
||||
var filename = splt[splt.length - 1];
|
||||
|
||||
var dest = file.path.replace(__dirname, '../angular-ionic/modules');
|
||||
dest = dest.replace(filename, '')
|
||||
|
||||
doubleCheckDistFiles();
|
||||
|
||||
return gulp.src(file.path).pipe(gulp.dest(dest));
|
||||
});
|
||||
|
||||
watch('ionic/components/*/test/**/*', function() {
|
||||
doubleCheckDistFiles();
|
||||
gulp.start('old.ionic.examples');
|
||||
});
|
||||
|
||||
watch('ionic/components/**/*.scss', function() {
|
||||
gulp.start('old.sass');
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function doubleCheckDistFiles() {
|
||||
if (!fs.existsSync('../angular-ionic/dist/js/dev/es5/css')) {
|
||||
gulp.start('old.sass');
|
||||
}
|
||||
|
||||
if (!fs.existsSync('../angular-ionic/dist/js/dev/es5/fonts')) {
|
||||
gulp.start('old.fonts');
|
||||
}
|
||||
|
||||
if (!fs.existsSync('../angular-ionic/dist/js/dev/es5/vendor')) {
|
||||
gulp.start('old.vendor');
|
||||
}
|
||||
}
|
||||
|
||||
gulp.task('old.clean', function(done) {
|
||||
del(['../angular-ionic/modules/ionic, ./angular-ionic/modules/examples/src/ionic'], done);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('old.ionic.copy.js', function(done) {
|
||||
return gulp.src(['ionic/**/*.js', '!ionic/components/*/test/**/*'])
|
||||
.pipe(gulp.dest('../angular-ionic/modules/ionic'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('old.ionic.examples', function() {
|
||||
var indexContents = _.template( fs.readFileSync('scripts/e2e/angular.template.html') )({
|
||||
buildConfig: buildConfig
|
||||
});
|
||||
|
||||
// Get each test folder with gulp.src
|
||||
return gulp.src('ionic/components/*/test/*/**/*')
|
||||
.pipe(rename(function(file) {
|
||||
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
|
||||
}))
|
||||
.pipe(gulpif(/index.js$/, processMain()))
|
||||
.pipe(gulp.dest('../angular-ionic/modules/examples/src/ionic'))
|
||||
|
||||
function processMain() {
|
||||
return through2.obj(function(file, enc, next) {
|
||||
var self = this;
|
||||
self.push(new VinylFile({
|
||||
base: file.base,
|
||||
contents: new Buffer(indexContents),
|
||||
path: path.join(path.dirname(file.path), 'index.html'),
|
||||
}));
|
||||
next(null, file);
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
gulp.task('old.sass', function() {
|
||||
return gulp.src('ionic/ionic.scss')
|
||||
.pipe(sass({
|
||||
onError: function(err) {
|
||||
console.log(err)
|
||||
}
|
||||
}))
|
||||
.pipe(autoprefixer(buildConfig.autoprefixer))
|
||||
.pipe(gulp.dest('../angular-ionic/dist/js/dev/es5/css'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('old.fonts', function() {
|
||||
return gulp.src('ionic/components/icon/fonts/**/*')
|
||||
.pipe(gulp.dest('../angular-ionic/dist/js/dev/es5/fonts'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('old.vendor', function() {
|
||||
return gulp.src(['scripts/vendor/**/*'])
|
||||
.pipe(gulp.dest('../angular-ionic/dist/js/dev/es5/vendor'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('old.update.angular', function(done) {
|
||||
|
||||
if (!fs.existsSync('../angular-ionic')) {
|
||||
fs.mkdirSync('../angular-ionic');
|
||||
|
||||
console.log('cloning angular master...');
|
||||
exec('git clone git@github.com:angular/angular ../angular-ionic', function() {
|
||||
npmInstall();
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log('angular master: cleaning modules');
|
||||
del(['../angular-ionic/modules'], function() {
|
||||
|
||||
console.log('angular master: reset --hard...');
|
||||
exec('git reset --hard origin/master', {cwd: '../angular-ionic'}, function () {
|
||||
|
||||
console.log('angular master: git pull origin master...');
|
||||
exec('git pull origin master', function () {
|
||||
npmInstall();
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function npmInstall() {
|
||||
console.log('angular master: npm install (may take a while, chill out)...');
|
||||
exec('npm install', {cwd: '../angular-ionic'}, function () {
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gulp.task('old.karma', function() {
|
||||
return karma.start({ configFile: __dirname + '/scripts/test/karma.conf.js' })
|
||||
});
|
||||
|
||||
gulp.task('old.karma-watch', function() {
|
||||
return karma.start({ configFile: __dirname + '/scripts/test/karma-watch.conf.js' })
|
||||
});
|
||||
|
||||
gulp.task('old.e2e', ['old.sass'], function() {
|
||||
var indexContents = _.template( fs.readFileSync('scripts/e2e/index.template.html') )({
|
||||
buildConfig: buildConfig
|
||||
});
|
||||
var testTemplate = _.template( fs.readFileSync('scripts/e2e/e2e.template.js') )
|
||||
|
||||
var platforms = [
|
||||
'android',
|
||||
'core',
|
||||
'ios',
|
||||
];
|
||||
|
||||
gulp.src(['ionic/**/*.js'])
|
||||
.pipe(gulp.dest('dist/src'));
|
||||
|
||||
// Get each test folder with gulp.src
|
||||
return gulp.src(buildConfig.src.e2e)
|
||||
.pipe(cached('e2e'))
|
||||
.pipe(rename(function(file) {
|
||||
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
|
||||
}))
|
||||
.pipe(gulpif(/main.js$/, processMain()))
|
||||
//.pipe(gulpif(/e2e.js$/, createPlatformTests()))
|
||||
.pipe(gulp.dest(buildConfig.dist + '/e2e'));
|
||||
|
||||
function processMain() {
|
||||
return through2.obj(function(file, enc, next) {
|
||||
var self = this;
|
||||
self.push(new VinylFile({
|
||||
base: file.base,
|
||||
contents: new Buffer(indexContents),
|
||||
path: path.join(path.dirname(file.path), 'index.html'),
|
||||
}));
|
||||
next(null, file);
|
||||
})
|
||||
}
|
||||
|
||||
function createPlatformTests(file) {
|
||||
return through2.obj(function(file, enc, next) {
|
||||
var self = this
|
||||
var relativePath = path.dirname(file.path.replace(/^.*?ionic(\/|\\)components(\/|\\)/, ''))
|
||||
var contents = file.contents.toString()
|
||||
platforms.forEach(function(platform) {
|
||||
var platformContents = testTemplate({
|
||||
contents: contents,
|
||||
buildConfig: buildConfig,
|
||||
relativePath: relativePath,
|
||||
platform: platform
|
||||
})
|
||||
self.push(new VinylFile({
|
||||
base: file.base,
|
||||
contents: new Buffer(platformContents),
|
||||
path: file.path.replace(/e2e.js$/, platform + '.e2e.js')
|
||||
}))
|
||||
})
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user