CSS not loading in Heroku, working in local foreman -
i using angular app working fine locally, using
foreman start -p 9000 web
also using
grunt serve
when deploying heroic, getting errors on missing css files. 1 example
https://rc-batchentry-dev.herokuapp.com/components/batch-review.css failed load resource: server responded status of 404 (not found)
i using grunt build tool.
web.js (relevant section)
// static files if (/development/.test(app.get('env'))) { console.log('environment: development'); app.use('/', express.static(__dirname + '/app')); app.use('/', express.static(__dirname + '/.tmp')); app.use('/bower_components', express.static(__dirname + '/bower_components')); } if (/production/.test(app.get('env'))) { console.log('environment: production'); app.use(express.static(__dirname + '/dist')); } // start server app.listen(process.env.port || 9000, function () { console.log('app started:', app.get('env')); });
index.html css section only:
<link rel="stylesheet" href="app.css"></link> <link rel="stylesheet" href="bootstrap.css"></link> <link rel="stylesheet" href="components/batch-delete.css"></link> <link rel="stylesheet" href="components/batch-design.css"></link> <link rel="stylesheet" href="components/batch-edit.css"></link> <link rel="stylesheet" href="components/batch-import.css"></link> <link rel="stylesheet" href="components/batch-review.css"></link> <link rel="stylesheet" href="components/batch-revisions.css"></link> <link rel="stylesheet" href="components/batch-view.css"></link> <link rel="stylesheet" href="components/batches.css"></link> <link rel="stylesheet" href="components/monitor.css"></link> <link rel="stylesheet" href="components/unsupported.css"></link>
heroku config:set node_env=production
the above environment setting resolved it, when looked @ heroku logs pointing development.
Comments
Post a Comment