Comments (4)
Thanks for the feedback @nathanhack - it's still very early days for myitcv.io/react
but I'm hopeful the approach will stand the test of time.
The CSS bit is great
This is actually one area of myitcv.io/react
that is very primitive in implementation terms. Much like the broader goal of myitcv.io/react
, the idea behind properly typing the various CSS properties is to reduce compile time errors, make code transformations easier etc.
But as you can see from the cssGen
template, they're not currently fully typed:
Line 23 in ffe10c5
For now I've essentially fallen back to a code generated equivalent of map[string]string
, per your proposal:
Line 13 in ffe10c5
The goal is ultimately to code generate the React elements from the HTML N spec. Similarly, the goal is to code generate the CSS types from the CSS N spec. Quite how code would interoperate between HTML versions is, I admit, an unknown. But it strikes me that problem is an easier one to solve than the cost of not having typed fields for HTML elements or CSS properties.
So what would this look like?
FontSize
would be an interface type with corresponding concrete types that allow for the restrictions described here, i.e. allow me to specify a percentage, absolute size, computed size etc.
There's plenty to work out here of course. But once complete we would effectively have a Go type-based encoding of HTML elements and CSS properties.
For now I'd prefer to stick to my halfway-house of having code generated properties but all of the string
type (which is equivalent to your proposal, minus the fact that the properties themselves need to have been defined). Which means we'll need to merge changes to cssGen
in order to define additional CSS properties.
Please feel free to ping back here with any specific properties, or if you're feeling generous you can submit a PR. If you need any guidance on what's required to submit a PR (because that's not documented) please also ping back here.
from react.
For now I'd prefer to stick to my halfway-house.
I believe your position is more than reasonable. Something is frequently better than nothing. However, doing some of the CSS in a css file and other parts in code isn't really the best design for my projects.
However, I REALLY REALLY like where the CSS implementation is heading. I also would like to contribute to its success. Partly, because I'm using it in my projects; and because I believe this project has the better approach than others.
Given what your ultimate goal is, I personal wouldn't put any more effort into any of the CSS properties as they are currently. (And thanks for even entertaining the idea. :-) But let's not.)
I have only about 8-10 unique CSS types/properties that I need for my current project and I would like to add them to your repo.
Could you provide a few more concrete details? Maybe outline, a few more of the details as you see it implemented for the FontSize case. So that I could start working on it.
Also, have you given much thought how to handle the case where the CSS is independent of HTML elements such as @media?
from react.
However, doing some of the CSS in a css file and other parts in code isn't really the best design for my projects.
This is a good point. I haven't (yet) given much thought to ways in which we could unify writing CSS in Go itself, or indeed whether that would even be a sensible goal. If we're going to the effort of generating types from the spec though, it wouldn't be so far fetched. We'd then need to come up with some sort of mechanism by which classes could be declared etc... definitely one to think about another day.
I have only about 8-10 unique CSS types/properties that I need for my current project and I would like to add them to your repo.
Great!
Could you provide a few more concrete details?
Sure, I'll pull something together when I get a moment.
Also, have you given much thought how to handle the case where the CSS is independent of HTML elements such as
@media
?
Nope. Very much falls into the same category as the class definitions etc - i.e. not thought much about it yet.
from react.
Apologies @nathanhack I haven't gotten round to looking at this yet.
from react.
Related Issues (20)
- Feature Request HOT 1
- Define aria-* attributes HOT 1
- Make go modules-compatible and switch to mono-repo HOT 18
- reactGen produces illegal code if element name starts with `v` HOT 1
- react.go line 71 conflicts with naming on HTML5 element `<s>` HOT 2
- Unable to use Props and States with maps and slices HOT 3
- How to write tests? HOT 3
- jsx.HTML silently fails to render valid input HOT 2
- Issue serving the HelloWorld page built by ReactGen (Windows 8.1 Command Prompt) HOT 3
- can not use input type="text" HOT 1
- Any suggestion import external react component?
- Form OnSubmit not mapped in FormProps
- ReactGen crash when judge HasEquals HOT 1
- StateGen store date conflict HOT 4
- State changes
- go get not working HOT 5
- Feature Suggestion: reactGen -init materializecss
- chrome react extension HOT 1
- how to import packages from npm
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 react.