Comments (24)
why do you try to use css-vendor on the server?
from css-vendor.
you do realize that this package only makes sense in the browser?
from css-vendor.
@kof I believe if you review the linked use-cases it should be clear. Writing Isomorphic JavaScript requires that the code adapts at runtime. Perhaps a future approach could see Isomorphic JavaScript resolved statically but that is way out of scope whereas this requested feature trivial: Give the user a function instead of executing code on their behalf.
from css-vendor.
The use-case is Server Side Rendering. In this case the API I'm working with is React.renderToString
but there is simply nothing here particular to React. The principal of Server Side Rendering and Isomorphic JavaScript is generic.
from css-vendor.
So you never have if (weAreOnServer) do this ... you expect EVERY single module to adapt if we are on server even if a module was designed to run in browser???
from css-vendor.
Does it works for things like localStorage etc?
from css-vendor.
ohhhhhh I get now the prob .... its because require is called before you can actually decide whether you need some module or not in a particular env, got it.
from css-vendor.
give me a sec
from css-vendor.
: D
from css-vendor.
fixed and published, thanks
from css-vendor.
Are you sure you published?
npm ERR! notarget No compatible version found: css-vendor@'>=0.2.4 <0.3.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.2.0","0.2.1","0.2.2","0.2.3"]
Note missing 0.2.4
that you said you published.
from css-vendor.
apparantly not ... sorry ... but now
from css-vendor.
Also some gaps in your initial patch (sorry to be the bearer of lame news):
- https://github.com/jsstyles/css-vendor/blob/master/lib/supported-property.js#L18
- https://github.com/jsstyles/css-vendor/blob/master/lib/supported-property.js#L6
- https://github.com/jsstyles/css-vendor/blob/master/lib/supported-value.js#L7
from css-vendor.
apparantly not ... sorry ... but now
Yep works now thanks! Just a few parts of the codebase that need to be updated now. Want me to get a PR going for this to help or not?
from css-vendor.
sure, prs are always welcome ...
from css-vendor.
Ok great. I'll try to put something together in the near future. Also I suggest we re-open this issue until said PR is merged etc.
from css-vendor.
oh so its still the same issue with dom?
from css-vendor.
For this issue to be resolved all dependencies on the Browser need to be guarded by environment checks which is what you have started to do. The alternative solution I suggested was to store these dependencies inside functions. The links above show where this library still makes unqualified use of the browser environment.
from css-vendor.
oh right, I checked only the one use pointed to first.
from css-vendor.
ok fixed and published again.
from css-vendor.
Still not working:
/Users/jasonkuhrt/projects/react-popover/node_modules/css-vendor/lib/supported-value.js:27
el.style[property] = value
^
TypeError: Cannot read property 'style' of undefined
at Object.module.exports (/Users/jasonkuhrt/projects/react-popover/node_modules/css-vendor/lib/supported-value.js:27:7)
at cssvalue (/Users/jasonkuhrt/projects/react-popover/lib/index.js:18:9)
at Object.<anonymous> (/Users/jasonkuhrt/projects/react-popover/lib/index.js:25:12)
at Module._compile (module.js:460:26)
at normalLoader (/usr/local/lib/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
But I may take a different strategy so don't worry about it... Thanks.
from css-vendor.
well this is because you actually use this plugin. What I was fixing is that you can't handle per environment setup because it throws before. Now you can, you just don't use the plugin serverside.
from css-vendor.
means
if (!NODE_ENV) jss.use(vendorPrefixer)
from css-vendor.
@kof Pardon me I tested against the wrong code. Looking again it appears to be working thanks.
from css-vendor.
Related Issues (20)
- An in-range update of webpack is breaking the build 🚨 HOT 5
- An in-range update of eslint is breaking the build 🚨 HOT 2
- An in-range update of webpack-cli is breaking the build 🚨 HOT 2
- An in-range update of lint-staged is breaking the build 🚨 HOT 3
- An in-range update of autoprefixer is breaking the build 🚨 HOT 5
- [bug] write-mode is not prefixed properly in Edge HOT 3
- An in-range update of autoprefixer is breaking the build 🚨 HOT 4
- An in-range update of babel7 is breaking the build 🚨 HOT 9
- An in-range update of autoprefixer is breaking the build 🚨 HOT 2
- An in-range update of lint-staged is breaking the build 🚨 HOT 4
- Missing support for `stretch` vendor values HOT 3
- An in-range update of lint-staged is breaking the build 🚨 HOT 4
- An in-range update of babel7 is breaking the build 🚨 HOT 2
- Method supportedValue should support !important property. HOT 4
- Update is-in-browser
- [vendor-prefixer | css-jss] width: fill-available doesn't transform in firefox HOT 4
- [jss-vendor-prefixer] clip-path to -webkit-clip-path not working HOT 2
- Please cut a new release to solve webpack 5 issue HOT 1
- `transition: var(--something, var(--fallback))` gets converted to `var(--something, false(--fallback))` HOT 1
- user-select should be prefixed in Safari
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 css-vendor.