86 | );
87 | }
88 |
89 | });
90 |
91 |
92 | var ApplicationStyles = StyleSheet.create({
93 |
94 | normalStyle: {
95 | backgroundColor: 'white',
96 | fontSize: '10pt',
97 | padding: '1em',
98 | margin: 10
99 | },
100 |
101 | childStyle: {
102 | marginRight: '0.5em'
103 | },
104 |
105 | lastChildStyle: {
106 | marginRight: 0
107 | },
108 |
109 | '@media screen and (min-width: 800px)': {
110 | normalStyle: {
111 | backgroundColor: 'purple'
112 | },
113 | childStyle: {
114 | marginLeft: 50
115 | }
116 | }
117 |
118 | });
119 |
120 |
121 | if (typeof window !== 'undefined') {
122 | React.render(, document.getElementById('app'));
123 | }
124 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015, VirtualCSS
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Planning for VirtualCSS
2 |
3 | Repository for planning and brainstorming on VirtualCSS.
4 |
5 | [](http://unmaintained.tech/)
6 |
7 | For initial thoughts on the VirtualCSS system see the blog post [here](https://medium.com/@jviereck/modularise-css-the-react-way-1e817b317b04).
8 |
9 | # Goal
10 |
11 | 1. Ability to declare CSS styles in a way that a static CSS file can be produce during build time on the server.
12 | 2. Support the full feature when declaring CSS styles except cascading. That means in particular support pseudo selectors like :hover, media queries, and multiple declarations of the same style.
13 | 3. Support functions in the style declarations (see the `createSimpleButton` example [here](https://github.com/VirtualCSS/planning/issues/1#issuecomment-88999335)). This is in particular important to support CSS preprocessors similar to SASS on top of VirtualCSS but I also see value for pure CSS-in-JS solutions (e.g. a function for `gradients` that then will emit style definitions for gradients with all the vendor prefixes).
14 | 4. Ability to extend/overwrite style definitions. E.g. create a static substyle of "Button" called "BigButton" that is an enlarged version of "Button"
15 | 5. Ability to optimize the static CSS by rewriting the declared styles at build time.
16 | 6. Ability to provide developer tools extensions for browsers that makes tweeking the style definitions easy during development.
17 |
18 | # Non-Goals
19 |
20 | 5. Do not support generation of inline styles. The problem is that by using inline styles covering the full feature set of CSS (e.g. pseudo selectors) is non trivial. As the [`react-style`](https://github.com/js-next/react-style) project shows, it is doable, so maybe a future version of VirtualCSS can work together with `react-style` to support inline styles. But for now to focus the scope of the VirtualCSS project I doubt it is a good idea to support both inline styles and static css.
21 | 7. Provide high level APIs to developers to interact with VirtualCSS. Developers should not interact with VirtualCSS directly but use a different library that builds on top of VirtualCSS and talks to the lower bits provided by VirtualCSS. This way VirtualCSS can concentrate on the essential parts and don't have to deal with user ergonomics.
22 |
23 | # License
24 |
25 | Please note that the license for the VirtualCSS project is MIT and
26 | by contributing to the project you agree with the license. MIT was chosen
27 | as many other css-in-js libraries also use the MIT license.
28 |
--------------------------------------------------------------------------------