Ionic アプリを本番用に準備しようとしていますが、gulp-userref でいくつかのエラーが発生しています
私のインデックスファイルで
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy">
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<!-- build:css dist_css/styles.css -->
<link href="css/font-awesome.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/select.css" rel="stylesheet">
<link href="css/ionic.app.css" rel="stylesheet">
<link href="css/selectize.css" rel="stylesheet">
<!-- endbuild -->
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet"/>
<link href='https://fonts.googleapis.com/css?family=RobotoDraft:400,500,700,400italic' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="lib/ionic-material/dist/ionic.material.min.css" rel="stylesheet">
<link href="lib/ion-autocomplete/dist/ion-autocomplete.css" rel="stylesheet">
<link href="lib/ionic-toast/src/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/angular-mocks/angular-mocks.js"></script>
<script src="lib/angular-http-auth/src/http-auth-interceptor.js"></script>
<script src="lib/angular-ui-router/release/angular-ui-router.js"></script>
<script src="lib/ui-select/dist/select.js"></script>
<script src="lib/ion-autocomplete/dist/ion-autocomplete.js"></script>
<script src="lib/angular_ios9_patch/angular-ios9-uiwebview.patch.js"></script>
<script src="lib/ionic-material/dist/ionic.material.min.js"></script>
<script src="lib/angular-filters/dist/angular-filters.js"></script>
<script src="lib/angular-messages/angular-messages.js"></script>
<script src="lib/ng-file-upload/ng-file-upload.min.js"></script>
<script src="lib/ionic-toast/dist/ionic-toast.bundle.min.js"></script>
<script src="lib/ngstorage/ngStorage.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<!-- build:js dist_js/app.js -->
<script src="dist/dist_js/app/app.js"></script>
<script src="dist/dist_js/app/routes.js"></script>
<script src="dist/dist_js/app/controllers/controllers.js"></script>
<script src="dist/dist_js/app/services/services.js"></script>
<script src="dist/dist_js/app/AppSettings.js"></script>
<!-- endbuild -->
<!-- build:js dist_js/templates.js -->
<script src="dist/dist_js/app/templates.js"></script>
<!-- endbuild -->
</head>
<body ng-app="app" ng-strict-di>
<ion-nav-view nav-swipe="" nav-view-direction="none" nav-view-transition="ios" class="view-container"></ion-nav-view>
</body>
</html>
そして私のgulpfile.jsで
var useref = require('gulp-useref');
var paths = {
useref: ['./www/*.html']
};
gulp.task('default', ['sass', 'templatecache', 'ng_annotate', 'useref']);
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.templatecache, ['templatecache']);
gulp.watch(paths.ng_annotate, ['ng_annotate']);
gulp.watch(paths.useref, ['useref']);
});
gulp.task('useref', function (done) {
gulp.src('./www/templates/**/*.html')
.pipe(useref())
.pipe(gulpif('*.css', minifyCss()))
.pipe(gulp.dest('./www/dist'))
.on('end', done);
});
after_prepare フックにこのファイルがあります
var androidPlatformsDir_dist_css = path.resolve(__dirname, '../../platforms/android/assets/www/dist/dist_css');
var androidPlatformsDir_dist_js = path.resolve(__dirname, '../../platforms/android/assets/www/dist/dist_js');
var androidPlatformsDir_dist_index = path.resolve(__dirname, '../../platforms/android/assets/www/dist/index.html');
var androidPlatformsDir_www_css = path.resolve(__dirname, '../../platforms/android/assets/www/dist_css');
var androidPlatformsDir_www_js = path.resolve(__dirname, '../../platforms/android/assets/www/dist_js');
var androidPlatformsDir_www_index = path.resolve(__dirname, '../../platforms/android/assets/www/index.html');
console.log("Moving dist files to Android platform");
mv(androidPlatformsDir_dist_css, androidPlatformsDir_www_css, {mkdirp: true}, function(err) {
if(typeof err != 'undefined')
{
console.log("err");
console.log(err);
console.log("ERROR when moving CSS folder to Android platform");
}
else
{
console.log("CSS folder moved OK to Android platform");
}
});
mv(androidPlatformsDir_dist_js, androidPlatformsDir_www_js, {mkdirp: true}, function(err) {
if(typeof err != 'undefined')
{
console.log("err");
console.log(err);
console.log("ERROR when moving JS folder to Android platform");
}
else
{
console.log("JS folder moved OK to Android platform");
}
});
mv(androidPlatformsDir_dist_index, androidPlatformsDir_www_index, function(err) {
if(typeof err != 'undefined')
{
console.log("err");
console.log(err);
console.log("ERROR when moving index.html file to Android platform");
}
else
{
console.log("index.html file moved OK to Android platform");
}
});
ionic.project ファイルの gulpStartupTasks に「userref」を追加しましたが、実行するたびionic build android
にエラーが発生します
{ [Error: ENOENT, rename '/home/k1ngsley/Projects/mobile_rea/platforms/android/assets/www/dist/index.html']
errno: 34,
code: 'ENOENT',
path: '/home/k1ngsley/Projects/mobile_rea/platforms/android/assets/www/dist/index.html' }
ERROR when moving index.html file to Android platform
err
{ [Error: ENOENT, rename '/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/platforms/android/assets/www/dist/dist_css']
errno: 34,
code: 'ENOENT',
path: '/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/platforms/android/assets/www/dist/dist_css' }
ERROR when moving CSS folder to Android platform
新しい index.html で dist フォルダーを作成し、dist_css フォルダー wt styles.css を作成しないのはなぜですか?
どんな助けでも大歓迎です