Giter Site home page Giter Site logo

Comments (9)

xonecas avatar xonecas commented on June 3, 2024

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.

ngryman avatar ngryman commented on June 3, 2024

Ok, I'll begin w/ the Browserify impl.

from server-configs-node.

ngryman avatar ngryman commented on June 3, 2024

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.

ngryman avatar ngryman commented on June 3, 2024

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.

ngryman avatar ngryman commented on June 3, 2024

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.

bnjmnt4n avatar bnjmnt4n commented on June 3, 2024

I'm not very sure what the syntax is. Can someone help?

from server-configs-node.

ngryman avatar ngryman commented on June 3, 2024

@D10 What do you mean?

from server-configs-node.

bnjmnt4n avatar bnjmnt4n commented on June 3, 2024

If you have a few files and you want to concat it to main.js, how do you specify it?

from server-configs-node.

ngryman avatar ngryman commented on June 3, 2024

I've just finished AMD impl.

@D10
Well for now you should have a main.js file that requires its dependencies itself like this:

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.