Congenital disability, acquired deformity.
Foreword: All the time, this piece is always vague, do not understand what exactly is, organize into the text, the idea, think where to write to where.
The beginning of the Web:
The birth of the application is relatively simple, the back-end control of everything, so, directly behind the staff to write a good. Html CSS JS does not have the concept of modularity. Lead to congenital deformity of the front end, acquired deformities.
Development of
Application is too large, a full-time front-end, resulting in code separation. Front end appears,
Hierarchy of structure style behavior.
The era of the big front
Applications are getting bigger, and must be layered. The structure of the MVVM appears. AMD's module management program. No planning page starts to mess up.
Thinking about the structure of the project:
The project consists of modules composed of components, shared and private. This is the modularity of your business, modularity of your code. Mainly have html,css, JS can use AMD's scheme to do.
The thinking of HTML:
Defect: no embedding function.
Requirements: Layout (layout) partials (component) module.html
Css:
Common.css Module.css
It is simpler to manage with less and can have embedded functions. Can be divided into a single function or page to write.
JS: According to the module to write. The modules are then referenced in the page. This is my train of thought.
About Packaging: it can reduce requests. But size also gets bigger. This looks like the situation put, first load not more than 1m I feel OK. Big of the cut it, otherwise affect the experience. I think it's OK to pack by the module. Don't be so big. CSS may not be packaged in a conflict, you can add a prefix to the module to distinguish, and finally can be packaged into one.
Solution. It's FIS + require.
This is the concept of the component is weaker. He is a mixture of JS HTML, HTML to insert. JS can require in.
Today's development methods. MVVM: What the hell is he?
It's about the same as above. is a single page. Use JS to control the page just. Run JS at the same time, switch out, to destroy.
An applied structure:
Extracts something from an application. Easy to manage. Equivalent to a common module.
If some functions can be taken out alone. The configuration information of the project can be taken out.
Config factory just mvvm a few more things. Filter directives for Routing and Templates
All right, I don't know what to say.