-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add front-end preset #14
Comments
A |
My front-end structure proposal: Project example
_src/app.js_ import Megazord from './lib/megazord';
let app = new Megazord(); _src/lib_ class Megazord {
constructor() {
console.log('App init');
}
} _src/lib/modules_ let util = {
log (msg) {
console.log(msg);
}
}
export default util; _src/tests_ _src/sample/index.html_ <html>
<head>
<script src="dist/bundle.js"></script>
</head>
</html> PS: We'd need to take care of modules on the front-end by using Browserify if the project was generated with CJS or RequireJS for AMD. |
I guess the directory structure doesn't (read: shouldn't) matter too much. As for the output format, I was thinking about using AMD (RequireJS) so that only the changed files are touched -- easier to implement incremental build, with better performance as you don't have to cache and concatenate the other files on every incremental build. |
Having a skeleton is good for novices, and i think a lot of novices (in ES20xx at least) will use Slush-es20xx. About AMD and CJS, i agree we can start with RequireJS, but IMHO Browserify should be supported soon, as we can keep the same CJS structure both in Node.js and the Browser. |
Agreed, a simple and functional starting structure is good. That's what I'm trying to do with the Node skeleton as well.
From the implementation point of view, things are a bit more complicated:
So far, I've been trying to avoid splitting the JS pipeline logic, but it might as well be inevitable at some point. Might be worth experimenting with two independent watchers/pipelines in this case. |
I'm starting to doubt whether adding a front-end preset would be a good idea. My main concern is that front-end development has such a diverse ecosystem, and es20xx is not (easily) pluggable. Think about CSS preprocessors, custom build/output formats, sprite generation and so much more. I've been experimenting with webpack's react-starter, and I'm astonished how efficient it is. Its hot module replacement mode is far more efficient than pretty much any other workflow out there (similar to JetBrains' live DOM update and JS recompilation). Also, webpack is pluggable. Bottom line is, I don't really feel like releasing a suboptimal non-pluggable front-end workflow. Thoughts? |
Hum, i don't know. |
Yeah, it is not hard to implement a simple, opinionated front-end preset. |
Here's my current plan:
|
Perhaps we can make this much simpler: add Webpack to the build and watch pipelines, allowing the user to disable it through the config options (#13). "Isomorphic"/"Universal" JavaScript is quite mainstream nowadays, so there's little or no separation between back-end and front-end code. Even if you have completely distinct front-end code, it should be no problem to configure it to be compiled with Babel and Webpack in the current infrastructure. |
Might also be interesting to support both back-end and front-end transpiling in the same project.
The text was updated successfully, but these errors were encountered: