-
Notifications
You must be signed in to change notification settings - Fork 27
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
EXPERIMENTAL: Atomic styles #21
Comments
@brianium Would you mind to test this on your project and report before/after output bundle size? |
sure thing - I should be able to check it out tonight or tomorrow. |
@roman01la not sure what's going on, but my before and after are the same (both 340K). I also got some warnings when trying out the Brians-MacBook-Pro:web brian$ lein cljsbuild once min
Compiling ClojureScript...
Compiling ["resources/public/js/compiled/boojit.js"] from ["src"]...
WARNING: Use of undeclared Var boojit-web.login.views/&:hover at line 64 /Users/brian/projects/boojit/deliveries/web/src/boojit_web/login/views.cljs
WARNING: Use of undeclared Var boojit-web.login.views/&:active at line 62 /Users/brian/projects/boojit/deliveries/web/src/boojit_web/login/views.cljs
WARNING: Use of undeclared Var boojit-web.login.views/&:hover at line 64 /Users/brian/projects/boojit/deliveries/web/src/boojit_web/login/views.cljs
WARNING: Use of undeclared Var boojit-web.login.views/&:active at line 62 /Users/brian/projects/boojit/deliveries/web/src/boojit_web/login/views.cljs
Successfully compiled ["resources/public/js/compiled/boojit.js"] in 9.881 seconds.
Brians-MacBook-Pro:web brian$ du -h resources/public/js/compiled/boojit.js
340K resources/public/js/compiled/boojit.js The application still functions for the most part - but pseudo classes don't appear to be functioning - which makes sense given the warnings. As for file size, it may be that my app is not large enough yet? It is really just login functionality at the moment - but still more components and styles than are in the cljss example. |
@brianium I think I've fixed pseudo-selectors, but anyway, I've also tested this on a somewhat larger amount of styles and surprisingly the output got larger. Let's step aside from this for a while, it's definitely not a priority, at least for now. Maybe I'll get back to this later. Thanks. |
Pushed initial implementation into
atomic-styles
branch 5b2cf7aThe idea is to to have a unique class name per every rule/value pair so style declarations can be reused. In this implementation only static styles are atomized.
It is based on this atomic styles implementation which in turn is inspired by Styletron library
As described in the article linked above this approach has a potential to non-growing stylesheets which reduces output code size. Still this should be measured.
cljss.atomic
(cljss.atomic/insert-css!)
at the very end of the entry ns (core.cljs
) which will generate a sequence of styles insertion callsThoughts?
The text was updated successfully, but these errors were encountered: