I'm using expressjs and handlebars to serve webpages. All my javascripts are inside the public/javascripts folder and my stylesheets are inside public/stylesheets.
Loading .css or .js files from inside there works. But now I have a folder public/vendors/bower_components/ with subfolders inside.
On localhost it loads items from inside the vendor folder but not when I serve pages to the public or when I commit it to Heroku.
This is my static folder:
app.use(express.static(path.join(__dirname, 'public')));
This is how I include the JS/css:
<script src="vendors/bower_components/jquery-toast-plugin/dist/jquery.toast.min.js"></script>
<link href="vendors/bower_components/jquery-toast-plugin/dist/jquery.toast.min.css" rel="stylesheet" type="text/css">
I already tried adding a forward slash to vendors but it still doesn't get served. Folder structure:
05/09/2018 13:22 .
05/09/2018 13:22 ..
03/09/2018 08:27 fonts
03/09/2018 08:27 img
05/09/2018 13:22 javascripts
03/09/2018 16:40 lib
05/09/2018 09:49 stylesheets
05/09/2018 09:45 vendors
05/09/2018 09:46 bower_components
05/09/2018 09:46 jquery-toast-plugin
05/09/2018 09:46 dist
06/09/2016 14:49 jquery.toast.min.css
06/09/2016 14:49 jquery.toast.min.js
Any help is greatly appreciated!
Is vendors or bower_components directory tracked by git? If not is any build scripts run by heroku during the deployment? This scripts containes the bower install command?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.