foundation-apps icon indicating copy to clipboard operation
foundation-apps copied to clipboard

Running app templates gives an error

Open alper opened this issue 9 years ago • 12 comments

I'm trying out the app templates provided for foundation but when I try to run one it gives me the following error on angular.js: Uncaught SyntaxError: Unexpected token <

That shows there's a <!doctype html> at the top of my angular.js file (which I think is weird). Foundation is expecting angular.js to be served and instead it is getting an HTML file?

alper avatar Jul 06 '15 14:07 alper

Ok, so it turns out that the development server isn't actually serving the linked javascript files:

http://localhost:8080/assets/js/angular.js

Just returns the default HTML.

alper avatar Jul 06 '15 15:07 alper

Ok, it turns out that this file is in the client/assets/js directory but is not carried over to the build directory for some reason. Removing it fixes at least the error message. I don't know whether it's intended.

alper avatar Jul 06 '15 15:07 alper

Which template are you using? Is it one from our resources page or the official starter template?

gakimball avatar Jul 06 '15 17:07 gakimball

It's the templates for these preboiled apps: http://foundation.zurb.com/apps/

alper avatar Jul 07 '15 08:07 alper

The template I get when I run newapp does work for some reason.

alper avatar Jul 07 '15 08:07 alper

Okay, are you running the downloadable templates or the one that's created when you run foundation-apps new app?

After that, what command do you run and what's the error you get?

gakimball avatar Jul 07 '15 16:07 gakimball

I'm using the downloadable ones. The browser gives an error message when trying to run those.

alper avatar Jul 08 '15 09:07 alper

What's the error?

gakimball avatar Jul 08 '15 15:07 gakimball

One of the sources for a js file does not return javascript but HTML instead and it chokes on that.

alper avatar Jul 08 '15 15:07 alper

I was having this issue as well, using a download of the email app template. angular.js shows in Chrome as having the same source as index.html.

It looks like the issue is that the I first created an app using the foundation CLI, then copied the source for the email app template into the client directory and just tried to use it. The default gulpfile.js doesn't automatically scrape all the files from the client directory upon build; and so angular.js doesn't appear in the build folder for the app. When the build folder is served in the browser, there's no angular.js file to load and instead the default root file for the site is served (index.html).

jmatthiesen avatar Oct 08 '15 06:10 jmatthiesen

Upon closer inspection, the issues are definitely related to trying to copy the sample app template files (e.g. the email template) into a project that was build with the Foundation CLI. My throught that some files were missing was wrong, I see in the build scripts how Angular gets pulled in to foundation.js for the built app.

To ease working with the email template (from this site: http://foundation.zurb.com/apps/resources.html), is there a place to get the un-compiled source for the templates? I'd like to be able to work with a version of the actual client folder for the template, including the SCSS used to build the template.

jmatthiesen avatar Oct 09 '15 06:10 jmatthiesen

The setup for those templates is admittedly fairly messy—we don't even have a good process for updating their dependencies. I can't say this will be fixed soon unfortunately, but we know it's something we need to do.

I can ask today if we can carve out some time to change those ZIP files.

gakimball avatar Nov 02 '15 15:11 gakimball