Comments (5)
Oooh okay. I was looking at the pre-optimization files, I guess.
So what's happening is under :simple
optimization, the style factory functions are declared as, eg:
yacwat_simple.styles.global_class_factory$=function(a,b){ /* ... etc */}
Under :none
optimizations (dev mode), it looks like:
yacwat_simple.styles.global_class_factory$ = (function yacwat_simple$styles$global_class_factory$(style_name20047,params20048){
/* ... etc */
})
and in :advanced
optimization, it's simply eg:
function p_(a,b){ /* ... etc. */ }
As background, to avoid having to embed a string with the style name (and consequently unnecessarily inflating the JS file in :advanced
compilation mode) I'm using the name
of the function that generates the style to uniquely identify the style across the app. This makes sense because in :none
mode the name of the function is the fully-qualified clojure name, and in advanced it's a globally unique short name, so in development you can also easily see which element comes from which function.
Since I'm assuming that closure will generate a function with a name, the way :simple
optimizations generates the function declaration javascript breaks everything. Hmm....
from spade.
Hey so I just published version 1.0.4 which I believe fixes the issue. Please let me know how it works for you!
from spade.
Huzzah! It works! Thanks for the speedy response and fix!
As an aside, I've been using this library successfully since its public debut, and it has been a joy to switch over to from css-modules and herb. Love the simplicity and flexibility it provides, and I've been a heavy advocate for it when the occasions arise in r/Clojure
and at the workplace! Just commending you on your work :)
from spade.
Your welcome! Glad to hear it's working :)
Thanks so much! That means a lot. I started this because I was also a bit frustrated with the existing solutions, so I'm happy to see that others are enjoying it as much as I am :)
from spade.
Thanks for the report! This is indeed odd, and it's definitely not intended that we don't work under :simple
optimization. I guess I've only tested in dev and :advanced
modes, so I've never seen this before. In fact, it looks like none of the styling works correctly under :simple
optimization.
Looking at your sample project, it seems like the factory functions don't have a .name
property when compiled under :simple
optimizations. It's unclear why, though; the code generated in dev and :simple
mode seems to be the same. But this is the cause—we use the name of the style function to generate the style ID to know which element to update in the DOM when/if the style changes....
from spade.
Related Issues (9)
- Support composition
- Generate appropriate arglist meta for functions
- Trouble with Media Queries HOT 5
- Further optimize for the expected case of "pure" style functions HOT 1
- Support for Custom DOM Injection Targets HOT 6
- Binding Forms Incompatible with defclass HOT 1
- Compose Multiple Styles HOT 6
- A little glitch in the defglobal macro HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spade.