Ionic 2 Blank template - no gulpfile.js


#1

Hi there, I am trying to start my ionic2 project from the blank template

ionic start MyFirstProject blank --v2

but when I start adding a new view and run ionic serve the transpile states that he can’t find the view files. Code is below. Could it be that the gulpfile.js is missing for that project?

I added it with

ionic g page custom-view

hoping the command would take care of any dependencies

me@mybook ;) ionic serve
******************************************************
 Dependency warning - for the CLI to run correctly,      
 it is highly recommended to install/upgrade the following:     

 Install ios-deploy to deploy iOS applications to devices.  `npm install -g ios-deploy` (may require sudo)

******************************************************

> ionic-hello-world@ ionic:serve /Users/me/Documents/Typescript/MyFirstProject
> ionic-app-scripts serve

[07:08:31]  ionic-app-scripts 0.0.45 
[07:08:31]  watch started ... 
[07:08:31]  build dev started ... 
[07:08:31]  clean started ... 
[07:08:31]  clean finished in 12 ms 
[07:08:31]  copy started ... 
[07:08:31]  transpile started ... 
[07:08:36]  template error, 
            "/Users/me/Documents/Typescript/MyFirstProject/src/pages/custom-view/build/pages/custom-view/custom-view.html": Error: 
            ENOENT: no such file or directory, open 
            '/Users/me/Documents/Typescript/MyFirstProject/src/pages/custom-view/build/pages/custom-view/custom-view.html' 
[07:08:36]  transpile finished in 4.92 s 
[07:08:36]  webpack started ... 
[07:08:36]  copy finished in 5.16 s 
[07:08:47]  webpack finished in 11.60 s 
[07:08:47]  sass started ... 
[07:08:49]  sass finished in 2.13 s 
[07:08:49]  build dev finished in 18.68 s 
[07:08:50]  watch ready in 18.77 s 
[07:08:50]  dev server running: http://localhost:8100/

#2

Ionic 2 no longer uses Gulp, the build is done by the Ionic App Scripts.

As for your custom-view not found, you may be using an incorrect path in an import somewhere.


#3

OK, thanks about gulp

The product path he’s searching in is way too long.
It’s

/Users/me/Documents/Typescript/MyFirstProject/src/pages/custom-view/build/pages/custom-view/custom-view.html

but should be

/Users/me/Documents/Typescript/MyFirstProject/www/build/pages/custom-view/custom-view.html

and the file is not even being copied over to there.


#4

In the component decorator - templateURL, do you have to specify the name of the file or the path where the file will reside after build?

@Component({
  selector: 'page-custom-view',
  templateUrl: 'build/pages/custom-view/custom-view.html'
})

or

@Component({
  selector: 'page-custom-view',
  templateUrl: 'custom-view.html'
})

?


#5

That’s the right one, since the html file is in the same folder as the ts one.


#6

Thanks @mirkonasto :slight_smile: