Comments (7)
any luck?
from express-cdn.
I tried to add CDN()
to my req
object and do something like
app.use(function(req, res, next) {
res.send(req.CDN('/path/to/asset'));
});
It actually generates a CDN address for the asset but it's not being processed and uploaded to the CDN.
I guess it's because all of the assets are being scanned in the views dir and only on start time.
I am assuming that we have to scan on start time because of the propagation time it takes the files to go from S3 to CDN.
Can't think of any way to work around this...
from express-cdn.
maybe just use in your views and since it will
get uploaded you can reference it with res.send?
On Wed, Dec 4, 2013 at 3:05 AM, Michael Derazon [email protected]:
I tried to add CDN() to my req object and do something like
app.use(function(req, res, next) {
res.send(req.CDN('/path/to/asset'));
});It actually generates a CDN address for the asset but it's not being
processed and uploaded to the CDN.
I guess it's because all of the assets are being scanned in the views dir
and only on start time.I am assuming that we have to scan on start time because of the
propagation time it takes the files to go from S3 to CDN.Can't think of any way to work around this...
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-29786269
.
from express-cdn.
@mderazon how did that work?
from express-cdn.
@niftylettuce How would you recommend to handle dynamically generated assets? For example, the adding and displaying of user profile images.
Use case:
someObj.on "uploadComplete", (err, tmpFile) ->
image = CDN(tmpFile, raw: true)
saveImage(image)
I would be happy to contribute if you think this type of functionality wouldn't be out of scope for this project. If it is out of scope, do you think handling these on-the-fly uploads would be best handled using the aws-sdk
module independently?
from express-cdn.
@petesaia why not just use Gravatar for user profile images? I don't know the use case or why you need to handle dynamically generated assets, why aren't they generated ahead of time? Not sure what your service/use case is... there is probably a better way to solve it for you ahead of time (maybe Grunt or caching somehow?).
from express-cdn.
@niftylettuce Thanks for the quick reply and suggestion. The use case of an avatar was just an example. For the actual application, users are able to upload multiple images which need to get pushed up to the CDN post-startup. We actually decided to go with pkgcloud for only that component and stick with express-cdn for assets which are perfectly okay to be pre-compiled and pre-cached.
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.