Comments (9)
We could do more with the dependency management, offer regular concatenation, browserify, and even ender.js
app.use(h5bp({
scripts: {
order: ['app.js', ...],
concat: 'browserify | ...',
minify: true
}
});
Let's go for it.
from server-configs-node.
Ok, I'll begin w/ the Browserify impl.
from server-configs-node.
Here is a first draft of script concatenation using CommonJS : feature/concat
I am using Webmake instead of Browserify because it seems the last one removed their native express
middleware and the API is not very comfy...
Webmake seems to be pretty reliable and well maintained.
I will wait until we implement the cache feature before merging it to develop. Actually it concatenates the file on-the-fly for each request ... which is not what we want.
from server-configs-node.
Another thing, internally h5bp
has now layers which are much like middlewares.
A good thing is that we can handle these layers internally like we want and we do not pollute the application with a bunch of internal middlewares. Also the idea that the h5bp
middleware could register other middlewares is strange.
But, it makes me think that, at some point, this project could mutate into a collection of several category middlewares that could be configured together correctly with the createServer
function. h5bp
would become something like an express superset.
For now, I think the one-multi-purpose-middleware is a good approach because it is just simple for the user :-)
from server-configs-node.
CommonJS done. I have embeded a basic file caching system for now, to avoid concatenation on each request.
So this is meant to be used w/ cache busting to reflect file changes.
This expiry project has the good idea of including a url helper for connect / express apps. I think we should also propose something like this.
Now I'll go with other types of concatenations:
- AMD
- basic: a list of files w/ globs supported (
/**/*.js
).
from server-configs-node.
I'm not very sure what the syntax is. Can someone help?
from server-configs-node.
@D10 What do you mean?
from server-configs-node.
If you have a few files and you want to concat it to main.js, how do you specify it?
from server-configs-node.
I've just finished AMD impl.
@D10
Well for now you should have a main.js
file that requires its dependencies itself like this:
- using CommonJS: https://github.com/h5bp/node-server-config/blob/develop/test/fixtures/commonjs.js.
- using AMD : https://github.com/h5bp/node-server-config/blob/develop/test/fixtures/amd.js.
In the h5bp config you would just specify the path of your main
script:
scripts: {
concat: ['scripts/main.js'],
method: 'amd'
}
There will also be a more basic concatenation method more or like grunt-contrib-concat task.
I will make a PR before integrating all these changes to master
to discuss it w/ you guys :)
from server-configs-node.
Related Issues (20)
- Build something for responsive images HOT 11
- Support on-the-fly SCSS and LESS compilation HOT 7
- Explode tests in several files
- Scripts and stylesheets minification HOT 3
- Use pathname for file extensions checks
- Fix CORS for fonts and associated tests
- Requesting change to mime type logic HOT 3
- Update npm package and installation instructions HOT 3
- Allow users to customize processors and minifier options HOT 1
- Add `CONTRIBUTING.md` HOT 3
- Add `CHANGELOG.md`
- npm owner add ngryman HOT 1
- EventEmitter memory leak detected. HOT 1
- Bump dependencies. HOT 3
- Setup code style linting
- Add an `editorconfig` file
- Do we need `cache.js` in the repo? HOT 3
- v1.0.0 roadmap HOT 4
- Cannot find module "express/node_modules/send" HOT 7
- server-configs-node future 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 server-configs-node.