Comments (7)
I've never had this error. I'll try the upgrade and you can let me know if it fixes it.
from compact.
Hmm, I tried the pipe method and am still getting the same error. Definitely a bug somewhere beyond this library.
from compact.
After much frustration, I finally figured out the issue: The problem was that I was using the middleware in the order
app.use(compact.middleware(...));
app.use(express.static(...));
In which case, the compact middleware will recopy the files on every request (in debug mode)—including the requests to retrieve those files from the cache! The result is that the files are copied over as they're being served, leading to random errors.
The best workaround is to only use the compact middleware on requests for pages (swapping the order of the middleware should effectively do this), though this means that you have to load a page in order to see changes you've made to a script, which isn't ideal.
from compact.
I think the reason I don't observe this is because for my uses I don't use the global middleware and I don't have a need to view the compacted scripts.
By always applying compact on specific routes it will always be loaded after the static middleware.
from compact.
Makes sense. Might not be a bad idea to update the README, though. Other precompiler middlewares (like Stylus') are supposed to come before the static middleware, so I assumed compact's was as well.
On Nov 2, 2012, at 7:48 PM, Paul Serby [email protected] wrote:
I think the reason I don't observe this is because for my uses I don't use the global middleware and I don't have a need to view the compacted scripts.
By always applying compact on specific routes it will always be loaded after the static middleware.
—
Reply to this email directly or view it on GitHub.
from compact.
Done.
from compact.
You're a gentleman and a scholar.
from compact.
Related Issues (16)
- Any way to have the file regenerated when src files change? HOT 2
- Helper is not scoped to request, but to app
- Debug causes files with the same name to not work HOT 1
- Can't pass options through to Uglify HOT 1
- Using with Express 3.x HOT 5
- Test needed for namespace sourcePath addNamespace(..., sourcePath) HOT 1
- Wrong Should.js code pulled in... HOT 2
- path.existsSync... HOT 1
- Doesn't work on a windows server with FF14 client HOT 7
- Multiple compactJsHtml functions HOT 1
- The version of uglify-js used has vulnerabilities
- Docs need improving
- Timestamp update on compacted JS on each request HOT 2
- Third-party scripts (Feature) HOT 1
- Scripts not in order HOT 2
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 compact.