Hi I am new to Purescript and I want to write a PostCSS plugin with it. As this plugin will need to interact with the API of PostCSS, which is in Javascript, how can I use those method in Purescript? For example, I want to use their root.walkDecls
method in my code.
Have a read of this to get started: https://github.com/purescript/documentation/blob/master/guides/FFI.md
You’ll have to use the FFI for that. I’ll send a few links later that will teach you how to use it.
-
See the link that @afc posted above.
-
I encourage you to read the PureScript book if you are a beginner to PureScript. Chapter 10 is specifically about FFI, but I encourage you to start from the beginning if you aren’t in a hurry (that may not apply to you if you already know Haskell).
-
I also encourage you to read @JordanMartinez’s PureScript reference. Along with the PureScript book, these are some of the highest quality resources in the whole ecosystem. Again, if you’re in a hurry, you can go to the FFI section directly, but unless you know some Haskell, you’ll have a hard time understanding.
Thank you! This is really helpful
Thank you! I will try and read them all. FP is always hard to understand in the beginning but a joy in the end.