kenhkan / angular-curve

The Smoothest AngularJS Boilerplate
MIT License
11 stars 1 forks source link

Consolidate loading script #18

Closed kenhkan closed 10 years ago

kenhkan commented 10 years ago

Right now there are:

At least for production there should only be one file called loader.js. So under public/ in production mode, there should only be:

Five files and that's it.

@tUrG0n Sorry I didn't realize before. This is actually why we want a flat structure for the built files in public/. Now that we have templates.js built into app.js for more load-time performance. When the project is built it doesn't quite make sense to have two directories, one for three JS files, another for just one CSS file, and just one HTML file at root. What do you think?

kenhkan commented 10 years ago

@tUrG0n I've pushed the changes to the consolidate branch so you can check it out.

ghost commented 10 years ago

I like having all 3 files in one.

Regarding having a flat structure, its good assuming that you are not having any other custom css or js being added there from the /assets dir. But then again, I'm wondering if that's a good argument lol!

kenhkan commented 10 years ago

haha yea. If you look at the branch now there is nothing else in /assets other than index.html and loader.js. My argument would be if you're adding extra stuff for your project, just put it into its own little directory. You should never put any code under /assets anyway, so it'd all be images/fonts/etc.

What do you mean by "3 files in one"? You mean loader.js, app.js, and vendor.js? I believe it is Brunch's philosophy to have app and vendor separated because you tend to change your application much more frequently. Do you think there's a better approach to this?

For loader, it could be part of that single built file if we do end up combining app and vendor; otherwise, you would need to prepend the loading code in vendor.js and wrap app.js in a function to make sure execution order is maintained.

ghost commented 10 years ago

Agreed on the /assets argument.

As for 3 in one, i was talking abwt this old YES ad I saw when I was young (http://www.plus961.com/2013/08/very-old-abou-fouad-yes-3-in-1-ads/) :3
Kidding :P , i meant the loader.js config.js and init.js. Of course keep app.js seperate from vendor.js I was actually wodnering, if it doesnt make sense to somehow have vendor split in 2:

The point being that you'll rarely if not never have a new version of angular in there while plugins might be added. So, next time the user re-loads vendor, he'll have a smaller payload. Though, I think that's just over-engineering it.

kenhkan commented 10 years ago

haha. I have no idea what the guy and the woman are saying in the commercial.

Anyway, the three files you mentioned are already in one file called loader.js in the consolidate branch. So it's good to go! I'll merge it into master.

As for vendor.js split into two, that actually requires a Brunch-level solution, probably via a plugin. I would agree though that it's a nice to have. A possible solution is to have the repo maintainer inserts annotations in bower.json (like resolutions). The build step would read the bower.json and split the built files. Up for a challenge? :p

Regardless, that's outside the scope of angular-curve.

ghost commented 10 years ago

haha.. its an ad for that washing thing, and the guys says "3 in 1" :P

Yes, I haven't checked consolidate yet. I'll be pushing to production this weekend, so I'll be revisiting my brunch configs. Good opportunity to check ur updates :)

Could be similar to that.

Yup, that's outside angular-curse's scope :)

P.S. didn't you say that you moved away from angular? :P

kenhkan commented 10 years ago

I haven't thought of that solution. Good call! We can actually implement that as part of angular-curve in that case.

By the way, it's "curve", not "curse". Not exactly what we want people associating the project with. :p Perhaps we need a new name. haha

Well, I'm not moving away from it completely. I was just saying there are cases that AngularJS isn't the best tool for the job. That applies to all technologies. It's just unfortunate that we fall into the realm.

kenhkan commented 10 years ago

Fixed as of 53d9ea0e2bdf60c282905a9bfaf3b4411174eb4e

ghost commented 10 years ago

Gotcha :)

I guess the curse was just a typo ;P