Recently saw N introduced CSS framework, a few days ago I said a word: "In my limited vision, has not seen can really be called the CSS framework of the East ~", of course, it may be my vision is too small, or the world is too big, I still feel a lot of things I do not see.
Let's take a look at the next concept that I'm quite agreeable to:
Frame can be divided into white box (white-box) and black Box (Black-box) two kinds of frame.
The inheritance-based framework is called the White box framework. The so-called white box is visual, and the internal implementation details of the inherited parent class are known to the subclass. Application developers using the White box framework develop the system by deriving subclasses or overriding member methods of the parent class. The implementation of subclasses relies heavily on the implementation of the parent class, which restricts the flexibility and the complete nature of reuse. But the solution to this limitation can be to inherit only the abstract parent class, because the abstract class basically does not provide a concrete implementation. The white box frame is a skeleton of a program, and the user-derived subclass is an accessory to the skeleton.
The framework of object-based component assembly is the black box frame. The application developer obtains the realization of the system by organizing and assembling the object. Users only need to understand the external interface of the component, without needing to know the internal implementation. In addition, assembly is more flexible than inheritance, it can change dynamically, and inheritance is just a static compile-time concept.
Ideally, any desired function can be obtained by assembling the existing components, in fact the available components are far from satisfying the demand, and sometimes it is easier to acquire new components by inheritance than to assemble new components with existing ones, so the white box and the black box will be used in the development of the system at the same time. However, the white box frame tends to develop to the black box frame, and the black box frame is the ideal target for the development of the system.
Then look back on the Internet as much CSS framework (Yui is called "Yui Library CSS Tools" is not "Yui CSS Frameworks"), how much is really in the framework of the concept of writing, how much just define style base class. Of course, everyone's understanding of the framework is not necessarily, you may not agree with my statement.
To talk about CSS framework, not that I do not recognize the existence of this thing, I have been trying to do something like this a couple of years ago. For large web sites, front-end development requires a solution. The framework is naturally preferred. Unfortunately, I was too far away, I was too weak t_t, I just ask two points:
Manage the contents of the following things
Class/Component
Obviously, the 1th, CSS do not, 2nd, relative to other languages very weak said.
About a year ago to do a medium-sized website, I want to lazy, I think of content modularity, let programmers spell pages. About the direction is also encapsulated one after another function block, the programmer in the use of which piece of content as long as the use of the corresponding HTML and CSS, everyone is convenient, I do not spell the page, he does not have to repeat the set of code, everyone good is really good.
In the same site, almost the content block, multiple use is very normal thing, this is also let modularity become possible, such as a picture list, may be a list of user avatars, or groups of icon list, then how do you write it? The same thing?
. photolistuesr,.photolistgroup{/*_*/}
This is not to say no, but if suddenly said to add a similar? You may want to adjust the style at this point. And me? Try to use this way:
In that case, we began by separating out the things that were common, photolist as prototypes, and dealing with the details with the extra class. Some days ago, I wrote object-oriented XHTML and CSS programming, in fact, only half of it, the other half is a detailed example, but in order to do too many examples with the core has been written out, ^^ of course, there are certain problems, that is, the original prototype definition to be very cautious, To try to do later is a revision may not be modified. CSS this thing, basically a frame can only fit a station, of course, if the station is large enough, so use is meaningful.
The more modular the HTML and CSS, the more serious the problem is with the more fragmented the file. HTML is good, anyway is the application eventually to merge output a copy, but CSS will generally give the discard direct use. If in the example just now, the way to import CSS on a Web page is this:
@import URL (/xxx/photolist.css);
@import URL (/xxx/userct.css);
@import URL (/xxx/groupct.css);
That can even consider using the program to spell the page, but easy to use, the number of requests is also proportional to the general situation we will choose to manually merge files. Although the human brain is smarter than a computer, many times the brain's computational power is less than that of a computer. I have this idea, is to use the server-side program to deal with the publishing mechanism of CSS, about the direction is through the Web site access logs to analyze the use of various pages of the entire station, through the program to calculate which public use to merge, the order of merging (CSS file order will affect the priority), And so on various calculations and compressing the output.
Unfortunately, such a complex set of procedures may only be suitable for one station, or the same series of station groups. Although it's a bit of a toss-up, I believe that the portal-level site is necessary to use such a way, and of course the entire team must use the same design pattern.
PS: The above CSS publishing program, Just my fantasy, have not tried, interested friends can try, if there is an accident, not responsible.
Of course, these are still not called CSS frameworks, may only be called a system-level solution, after all, CSS is only descriptive language.
The night before the moon with the shadow to eat roast duck, have chatted to this, he asked me whether there is a front-end integration solution. JS component will also face the same problem, similar release mechanism should also be applicable to JS. But complete integration solution I haven't thought well, perhaps the shadow of the moon to invite me to eat several times roast duck I can think well.
The above is about the content of the discussion of CSS framework, more related articles please pay attention to topic.alibabacloud.com (www.php.cn)!