Comments (7)
@Nevtep what does your view look like for this? (e.g. how are you using != CDN()
?)
from express-cdn.
Yes, I have my code like this:
!= CDN('/stylesheets/app/button.css')
Should I reference .styl instead?
from express-cdn.
@Nevtep so for CSS files, express-cdn basically does a GET request to that URL and returns the body of the response. I recently patched this module, so you could first try removing and then installing the latest version 0.1.0. The problem likely lies with how your stylus middleware works. If the .css
file is not actually created locally in your filesystem when a request is sent to that URL, then when we try to upload it to S3, it will give you the error you're receiving. Here is where the GET request is https://github.com/niftylettuce/express-cdn/blob/master/lib/main.js#L329. Also note that the file must actually get saved to the filesystem, due to fs.statSync
being used to get the mtime.getTime()
which is used for appending a timestamp for cachebusting to the file (e.g. button.123456789.css
). I would recommend to check that the file is actually created at that path when the CSS file gets requested, example given below:
curl http://yourApp:3000/public/stylesheets/app/button.css
from express-cdn.
Nick, thanks for the quick response, actually the problem is just as you described, I'm .gitignoring *.css files since they get generated when the url is called, but they are not there the first time I call the url (eg, after a deploy) is there a workaround for this? since I would need to generate all css files locally before deploying each time to get them updated and get the correct timestamp, and start including them on the repo and deploys and would prefer not to do that.
from express-cdn.
Yeah, this is the same problem I have with my LESS assets (previously used Stylus). I just deploy the CSS to production after I test it locally.
from express-cdn.
Ok, will do... just a thought I had, would be cool to be able to reference stylus files (or less, or whatever is supported) and get the css file refence... the timestamp of the files wouldn't change, and you still get the content through a GET request so no need to include .css anymore =)
Thanks Nick, this library has given me great CDN integration and was simple to integrate it into my solution.
I'm closing this one.
from express-cdn.
You're very welcome, I'm glad it worked out for you too. I really appreciate this module's simplicity despite it being a bit "hacky". I've been able to deploy it to https://getprove.com in 5 minutes flat, and the optimization/performance it brings is staggering. The module overall needs a clean rewrite, maybe a few CDN sponsors, and then it'd be top notch where we need it :) Cheers and feel free to share your implementation to [email protected]
from express-cdn.
Related Issues (20)
- Express CDN doesn't support video/mp4
- Error when installing express-cdn HOT 2
- Error during install on node 6 due to outdated optipng-bin and jpegtran-bin dependencies HOT 2
- Files do not upload to s3 HOT 2
- BUG : removing the first character of file path HOT 1
- production true is giving errors
- Action required: Greenkeeper could not be activated 🚨
- When Uglify fails, it doesn't tell which file is failing it. HOT 1
- Older version of clean-css leaving truncated files HOT 1
- Error: TypeError: assets.substr is not a function
- Getting error after latest update HOT 2
- File file.js comes to S3 without content. HOT 2
- 0.31 and 0.32 releases are broken by UglifyJS 3.X HOT 2
- In package.json update dependency on 'request' module to 2.88.0
- BUG: timestamp cache not set properly
- Concatenating files doesn't produce a URL-encoded CDN address HOT 2
- Working with vars
- Explicitly define list of assets HOT 1
- Private bucket support
- Asset versioning in production HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-cdn.