Skip to content

Supported CSS

Crane uses Vite and Vue for builds. CSS is processed by Vite’s pipeline and Vue SFCs. No Crane-specific CSS config; support follows Vite’s defaults and app dependencies.

Pipeline

MechanismBehavior
Vue SFCs<style> in .vue files; optional lang="scss", lang="less", or plain CSS
Imports.css, .scss, .sass, .less, .module.css imported from JS/TS are processed by Vite
PostCSSIf postcss.config.js or postcss.config.cjs exists in app root, Vite runs it on CSS

INFO

crane build does not load your app’s vite.config.js. All options below rely on Vite’s default behavior and the dependencies you install.

Section CSS shares the page with Ecwid’s storefront. To avoid CSS variable clashes, prefix your custom properties — see CSS variable conflict prevention.

Reference

Plain CSS

  • Install: none
  • Files: .css; <style> or <style scoped> in SFCs
  • Usage: Import or inline in SFC
vue
<style scoped>
.card { padding: 1rem; }
</style>
ts
import './styles.css';

Sass / SCSS

  • Install: npm install -D sass
  • Files: .scss, .sass; SFC lang="scss" or lang="sass"
  • Usage: Import or <style lang="scss" scoped>
vue
<style lang="scss" scoped>
$primary: #3498db;
.card { background: $primary; }
</style>
ts
import './section.scss';

Crane uses the modern Sass compiler for internal builds where applicable.

Less

  • Install: npm install -D less
  • Files: .less; SFC lang="less"
  • Usage: Import or <style lang="less" scoped>
vue
<style lang="less" scoped>
@primary: #3498db;
.card { background: @primary; }
</style>
ts
import './section.less';

PostCSS

  • Install: Any PostCSS plugins you use (e.g. autoprefixer); config in app root
  • Config: postcss.config.js or postcss.config.cjs next to package.json
  • Usage: All CSS is run through PostCSS when config exists
js
// postcss.config.js
export default {
  plugins: {
    autoprefixer: {},
  },
};

CSS Modules

  • Install: none
  • Files: *.module.css (naming convention)
  • Usage: Import default; use returned object for class names (scoped by Vite)
css
/* styles.module.css */
.card { padding: 1rem; }
.badge { font-weight: bold; }
vue
<script setup lang="ts">
import styles from './styles.module.css';
</script>
<template>
  <div :class="styles.card"><span :class="styles.badge">New</span></div>
</template>

Tailwind CSS

Tailwind v3 (works with crane build): Use PostCSS. Add postcss.config.js in app root and Tailwind directives in your CSS.

  • Install: npm install -D tailwindcss postcss autoprefixer then npx tailwindcss init -p
  • Config: postcss.config.js with tailwindcss and autoprefixer
  • Usage: In CSS: @tailwind base; @tailwind components; @tailwind utilities; — import that CSS from section client or Vue entry

Tailwind v4 (Vite plugin): Requires the @tailwindcss/vite plugin in Vite config. crane build does not load vite.config.js, so for Tailwind processing during crane build use the v3 + PostCSS approach above.

Bootstrap

  • Install: npm install bootstrap; for SCSS also npm install -D sass
  • Usage: Import built CSS or Bootstrap SCSS
ts
import 'bootstrap/dist/css/bootstrap.min.css';
scss
@import 'bootstrap/scss/bootstrap';

Lightning CSS

  • Install: Use as a PostCSS plugin; add to postcss.config.js
  • Usage: Vite runs PostCSS; Lightning CSS runs as part of that pipeline

Summary table

ApproachInstallUsage / file pattern
Plain CSS.css, <style> in SFCs
Sass/SCSSsass.scss/.sass, lang="scss"
Lessless.less, lang="less"
PostCSSplugins + postcss.config.jsAll CSS (Vite runs PostCSS when config present)
CSS Modules*.module.css + default import
Tailwind v3tailwindcss, PostCSSpostcss.config.js + @tailwind in CSS
Tailwind v4@tailwindcss/viteVite config only (not applied in crane build)
Bootstrapbootstrap (+ sass for SCSS)Import CSS or SCSS
Lightning CSSPostCSS pluginVia postcss.config.js