• Home
  • Why Erstwhile?
  • Getting Started
  • Learn Erstwhile
  • API Docs
  • Home
  • Why Erstwhile?
  • Getting Started
  • Learn Erstwhile
  • API Docs
  • API Documentation
  • ErstwhileApp
    • getDebug()
    • getConfig(property)
    • setLayout(layout)
    • getComponent(id)
    • getModel(model)
    • redirect(path, updateHistory: true, scrollTop: true)
    • defer(func, delay: 0, selector: null)
    • openModal(controller, modal, args)
    • setModalAttributes(args)
    • closeModal()
  • ErstwhileComponent
    • getCSS()
    • isHidden()
    • hide()
    • show()
    • setProperty(property, value)
    • getProperty(property)
    • isContainer()
    • initialize()
    • unload()
    • getHTML(innerDom)
    • receiveUpdate(key, value)
    • receiveGlobalUpdate(key, value)
    • getTag()
    • getClassName()
    • prepareAttributes()
  • ErstwhileForm
    • getControl(name)
    • showErrors(response)
    • clearErrors()
    • registerComponent(id)
    • deregisterComponent(id)
    • getValues()
  • ErstwhileControl
    • getKey()
    • getValue()
    • setValue(value)
    • setValid(validFlag, message)
  • ErstwhileLayout
  • ErstwhileTheme
    • getRequires()
    • getCSS(appRootDir, workingDir, themeConfig)
    • getFontFolder(appRootDir)
    • getCSSFolder(appRootDir)
    • getJSFolder(appRootDir)
    • getCSSLinks(rootDir)
    • getScripts(rootDir)
  • ErstwhileController
    • preAction(next)
    • postAction(next)
    • getControllerPath()
    • getRoutes()
  • ErstwhileModel
    • makeRequest(path, params, method: "get", data, headers)

getCSS(appRootDir, workingDir, themeConfig)

17 views 0

Written by mike
August 4, 2023

Static Function

Arguments
  • appRootDir: The full directory being used to compile the app.
  • workingDir: The full working directory being used to compile the app. Typically /build within the app root.
  • themeConfig: Any theme-specific settings in the app.js config file under the themeConfig key.
Returns

String of the CSS needed to add to the bundle for this theme.

Effect

If your theme would like to add CSS to the bundle separately from what the individual components add, you would specify that here.

While it is still the early days of Erstwhile theme creation, it is quite common for general-purpose HTML themes to be adapted to work with Erstwhile. Most of these have their CSS generated through a preprocessor like SCSS. For these cases, this SCSS can be added to the theme’s /theme directory and then build within the working directory specified in the second argument at compile time.

The third argument lets you add custom configuration variables for your theme that a user could add to their application’s config file; for example, you may want to give theme a simple way to specify primary and secondary colors, or font sizes.

As this method does all of the compilation work and simply returns a (potentially giant) CSS string, you have a lot of latitude with how it does its work. Please see the sample Mazer theme for some ideas.

Note: This method is static and is called at compile time.

Was this helpful?

Yes  No
Related Articles
  • getControllerPath()
  • getRoutes()
  • postAction(next)
  • preAction(next)
  • makeRequest(path, params, method: “get”, data, headers)
  • ErstwhileModel

Didn't find your answer? Contact Us

Previously
getRequires()
Up Next
getFontFolder(appRootDir)

loader

Join our Mailing List     

  • Privacy Policy
  • Terms of Use
  • © 2025 RestlessDev. Made in New Orleans.

Welcome to Erstwhile

Thank you for checking out Erstwhile. We’re just getting started, so if you’d like to keep up with our progress please register now and we’ll let you know when new releases come out.

loader

Email Address*

Name