-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow build:debug and build:dist builds to run from file protocol #364
Comments
@shainegordon this sounds reasonable, would you like to try your hand at a proposal or pr? |
@stefanpenner truth be told, i am very green when it comes to javascript build processes, but I am definitely keen :) I assume that this will entail a custom grunt task and optional build config |
maybe @MajorBreakfast or someone else can help give you pointers :) |
Using the integrated development sever is best practice because features like push state routing can't work without it. That being said it is certainly possible to modify the grunt file so that it assembles your app completely:
Alternative solution: express = require 'express'
path = require 'path'
request = require 'request'
livereload = require('connect-livereload')()
publicDirectory = path.join __dirname, '../../public'
indexHTML = path.join publicDirectory, 'index.html'
servePublicDirectory = express.static publicDirectory
###
Development: Pipe through to localhost:8000
Production: Serve from `public/` directory, index.html if file doesn't exist
###
module.exports = (req, res, next) ->
if req.app.get('env') is 'production'
servePublicDirectory req, res, -> res.sendfile indexHTML
else
livereload req, res, ->
request('http://localhost:8000' + req.path)
.on('error', (err) ->
res.send 500, message: 'Grunt server is not running.'
)
.pipe(res) Note: It's CoffeeScript, use js2coffee.org if you need JS. I'm using the node packages: request, express and connect-livereload |
@MajorBreakfast Thank you very much, option 1 will suit me very nicely. I understand that running from file:// is not best practice, however, when building apps to run on the desktop with something like node-webkit, I have no choice. |
I understand. I think it's reasonable that at some point in the future we'll move everything to the tmp directory again. You're right: It could come in handy for this and maybe also for more. The mid term plan is to move away from grunt as the main build tool. Something much faster and intelligent is currently in the works by @joliss. |
@MajorBreakfast phonegap users will likely be at |
i think it would be easiest if we just support a configurable "base path" @MajorBreakfast got time to give it a go? |
Okay I'll look into it |
For this problem, you can use the app protocol and reference your index.html like:
See https://github.com/rogerwang/node-webkit/wiki/App%20protocol |
closing in favor of ember-cli/ember-cli#292 |
My current ember app (running in node-webkit) is built on an old pre jj-abrams-resolver EAK. this runs perfectly in my browser and nwk using the file:// protocol, eg from tmp/public/index.html
I see there is a lot of progress on EAK, and thought I would try it out. however, i noticed now that file:// no longer works. I see this is because vendor is now not placed in to "tmp/public".
would be really nice to be able to run from file again (ember js + node webkit = amazing cross platform deskop apps, but have to run in file protocol)
The text was updated successfully, but these errors were encountered: