Ionic 1 project doesn't execute gulp tasks


#1

Hi.

I’ve been maintaining a ionic1 project for about 2 years.
Today I had to change some CSS (SASS) and noticed that when I run “ionic serve” or “ionic cordova run android” the gulp file doesn’t run… so SASS doesn’t get compiled…

I’ve read “a thousand” forum articles and google search results and nothing seems to work… So I decided to create a new article here…

gulpfile.js

var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');

var paths = {
  sass: ['./scss/**/*.scss']
};

gulp.task('default', ['sass']);
gulp.task('serve:before', ['default','watch']);
gulp.task('run:before', ['default']);

gulp.task('sass', function(done) {
  gulp.src('./scss/ionic.app.scss')
    .pipe(sass())
    .on('error', sass.logError)
    .pipe(gulp.dest('./www/css/'))
    .pipe(minifyCss({
      keepSpecialComments: 0
    }))
    .pipe(rename({ extname: '.min.css' }))
    .pipe(gulp.dest('./www/css/'))
    .on('end', done);
});

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

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();
});

package.json:

{
    "name": "PRIVATE INFO",
    "version": "1.0.0",
    "description": "PRIVATE INFO",
    "dependencies": {
        "cordova-android": "^6.2.3",
        "cordova-instagram-plugin": "^0.5.5",
        "cordova-plugin-admobpro": "^2.29.21",
        "cordova-plugin-amazonmobileads": "~1.1.1",
        "cordova-plugin-apprate": "~1.2",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.1.0",
        "cordova-plugin-device": "^1.1.6",
        "cordova-plugin-extension": "^1.5.1",
        "cordova-plugin-google-analytics": "^1.8.2",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-whitelist": "^1.3.2",
        "cordova-plugin-x-socialsharing": "~5.1.6",
        "cordova-plugin-x-toast": "^2.6.0",
        "cordova-uglify": "^0.2.8",
        "cordova-universal-clipboard": "git+https://github.com/Visigo/CordovaClipboard.git",
        "gulp": "^3.9.1",
        "gulp-concat": "^2.6.1",
        "gulp-minify-css": "^1.2.4",
        "gulp-rename": "^1.2.2",
        "gulp-sass": "^3.1.0",
        "ionic-plugin-keyboard": "~2.2.1",
        "onesignal-cordova-plugin": "~2.0.10"
    },
    "devDependencies": {
        "@ionic/cli-plugin-cordova": "1.6.2",
        "@ionic/cli-plugin-ionic1": "2.1.1",
        "bower": "^1.8.0",
        "gulp-util": "^3.0.8",
        "shelljs": "^0.7.6"
    },
    "cordovaPlugins": [
        "org.apache.cordova.device",
        "org.apache.cordova.console",
        "com.ionic.keyboard",
        {
            "locator": "https://github.com/VersoSolutions/CordovaClipboard",
            "id": "com.verso.cordova.clipboard"
        },
        "onesignal-cordova-plugin"
    ],
    "cordovaPlatforms": [
        "android"
    ],
    "cordova": {
        "platforms": [
            "android"
        ],
        "plugins": {
            "cordova-plugin-amazonmobileads": {},
            "cordova-plugin-apprate": {},
            "cordova-plugin-x-socialsharing": {},
            "ionic-plugin-keyboard": {},
            "onesignal-cordova-plugin": {},
            "cordova-plugin-camera": {},
            "cordova-plugin-device": {},
            "cordova-plugin-google-analytics": {},
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-whitelist": {},
            "cordova-plugin-x-toast": {},
            "cordova-instagram-plugin": {},
            "cordova-plugin-admobpro": {}
        }
    }
}

I get this warning when running on android and I tryed to remove them but doesnt solve the problem…

[WARN] Detected @ionic/cli-plugin-cordova in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:
       
       npm uninstall --save-dev --save-exact @ionic/cli-plugin-cordova
       
[WARN] Detected @ionic/cli-plugin-ionic1 in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:
       
       npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic1

ionic.config.json:

{
  "name": "PRIVATE INFO",
  "app_id": "",
  "gulpStartupTasks": [
    "sass",
    "watch"
  ],
  "watchPatterns": [
    "www/**/*",
    "!www/lib/**/*"
  ],
  "type": "ionic1",
  "integrations": {
    "cordova": {}
  }
}

ionic info:

[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying ./bower.json.

cli packages: (/home/user/.nvm/versions/node/v7.0.0/lib/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    Cordova Platforms : android 6.2.3
    Ionic Framework   : unknown

System:

    Android SDK Tools : 26.1.1
    Node              : v7.0.0
    npm               : 3.10.8 
    OS                : Linux 3.19

Misc:

    backend : legacy

(I try to keep everything up to date)
Thanks for all the help.