put some tailwind in your elm
…yarn add postcss-elm-tailwind --dev
# OR
npm i -D postcss-elm-tailwind…See the demo for a full example.
If you want to use Tailwind classes to style SVG you can output an Svg module like this:
module.exports = {
plugins: [
require("tailwindcss"),
require("postcss-elm-tailwind")({
tailwindConfig: "./tailwind.config.js",
elmFile: "src/Tailwind.elm",
elmModuleName: "Tailwind",
formats: {
svg: {
elmFile: "src/Tailwind/Svg.elm",
elmModuleName: "Tailwind.Svg"
}
}
})
]
};If you want access to the class names themselves, you can output a String module as an escape hatch:
module.exports = {
plugins: [
require("tailwindcss"),
require("postcss-elm-tailwind")({
tailwindConfig: "./tailwind.config.js",
elmFile: "src/Tailwind.elm",
elmModuleName: "Tailwind",
formats: {
string: {
elmFile: "src/Tailwind/String.elm",
elmModuleName: "Tailwind.String"
}
}
})
]
};In order to get a small build, you'll need to build Tailwind twice - once
without purgecss to build TW.elm with all the classes and once with purgecss
so that all the unused classes are removed from your production CSS.
See how this is implemented in the demo.
No open issues yet, or sync has not completed.