Module

CssClassNameExtractor.Data.Output

Package
purescript-css-class-name-extractor
Repository
himanoa/purescript-css-class-name-extractor

#FileBody Source

#Output Source

data Output

Constructors

Instances

#replaceExt Source

replaceExt :: String -> String -> String

Replacement file extension

> replaceExt foo.js "css"
foo.css

#capitalizeFilename Source

capitalizeFilename :: String -> String

Filename head to upper

> capitalizeFilename foo.js
Foo.js

#makeCssFile Source

makeCssFile :: Namespace -> FileBody -> String -> Output

Make a CSS file output

> makeCssFile (Namespace "Data.Foo.Bar") ".foo { display: flex }" styles.module.css
CssFile { namesapce: Namespace "Data.Foo.Bar", body: ".foo { display: flex }"  }

#makeJsFile Source

makeJsFile :: FilePath -> Output

Make a Js file output

> makeJsFile "./src/components/styles.css"
JsFile { path ::  "./src/components/Styles.js" } 

#makePursFile Source

makePursFile :: Namespace -> FilePath -> List SelectorF -> Output

Make a Purs file output

> makePursFile (Namespace "Data.Foo.Bar") "./src/components/styles.css" List.fromFoldable [Class "foo"]
PursFile { path ::  "./src/components/Style.purs", namespace: (Namespace "Data.Foo.Bar"), classNames: [Class "foo"] } 

#renderOutput Source

renderOutput :: Output -> FileBody

Convert Output to FileBody. This function extracts the content from CSS files CSS file -> Extracts the content JS file -> Generates a JavaScript module that imports and exports CSS modules with a helper function Purs file -> Generates a PureScript module that exports class names as constants with an FFI helper function

#getDistPath Source

getDistPath :: Output -> FilePath

Returns the destination file path for the given output. The path is determined based on the output type and configuration settings.