linemanjs / lineman-angular-template

A Lineman Application Template using AngularJS
251 stars 88 forks source link

broken distribution with "lineman build" #40

Closed ricricucit closed 10 years ago

ricricucit commented 10 years ago

I have this weird problem with "lineman build" that i can't solve.

Following the steps that generate the error:

1) OK: run the build script 2) OK: everything runs smoothly and i put the content of the "dist" folder online 3) PROBLEM: the app will try to load "main.html" (which is a template file URL) that obviously return a 404. 4) PROBLEM: i re-run "lineman run" to fix the issue and i discover that even my app running from the "generated" folder is "broken" (looking for the main.html file)

to fix the dev i simply have to re-save "main.html" that triggers this:

Running "ngtemplates:app" (ngtemplates) task
File generated/angular/template-cache.js created.

Running "concat_sourcemap:js" (concat_sourcemap) task
File "generated/js/app.js" created.

which makes the "dev app" (the one in the "generated" folder) work again.

So the "real" problem is....why does the built version look for my template files URLs? Any help it's appreciated, thanks!

davemo commented 10 years ago

I can't replicate your problem, can you add a link to the place you put the dist folder online?

I cloned lineman-angular-template, and then ran lineman build and started a simple static webserver in the dist directory and things worked fine for loading the precompiled templates. Obviously the /login endpoint doesn't exist, but that's to be expected.

For reference, here's the server function I'm using as part of my dotfiles

# Start an HTTP server from a directory, optionally specifying the port
function server() {
  local port="${1:-8000}"
  open "http://localhost:${port}/"
  # Set the default Content-Type to `text/plain` instead of `application/octet-stream`
  # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
  python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
}
ricricucit commented 10 years ago

(link to the dist folder and to my app's repo sent privately)

ricricucit commented 10 years ago

I found the problem in application.js

where i had: // configure lineman to load additional angular related npm tasks loadNpmTasks: lineman.config.application.loadNpmTasks.concat("grunt-ng-constant"),

moving this at the end of the file solved my problem.....but i'm still not sure why this line of codes causes the problem...