Skip to main content
Version: 0.2.x

Configuration

SALVO-TS is configured through the salvo.config.js file in the root of the project.

This file must export an object which matches the configuration structure. The file is JS rather than JSON, so you can add comments and perform calculations to build your configuration.

Reference

ItemDescriptionDefault
buildVariantControls which build variant the compiler builds.undefined
entryMain entry point for the theme javascript. Relative to root directory.
Specified as an array - additional files will all be merged into the same entry point.
['./src/main.ts']
cssMain entry point for the theme stylesheet. Relative to root directory.
Specified as an array - additional files will all be merged into the same entry point.
['./assets/styles/theme.scss']
output.themeJsSpecifies asset name of the main theme javascript.theme.min.js
output.themeCssSpecifies asset name of the main theme stylesheet.theme.css.liquid
extraCssSpecifies additional extra css to build.[]
aliasSpecifies path aliases for imports.{'@': path.resolve('./src/'), '@assets': path.resolve('./assets/')}
components.sass.defaultImportsAn array of SCSS files to automatically import into every component stylesheet, used to share variables with components.['./assets/styles/variables.scss']
components.sass.cssBuildModeMethod for loading component CSS.
One of:
  • "inline": Inline component CSS into component JS files.
  • "async": Always load component CSS from a separate CSS file
  • "auto": Use inline or async behavior depending on the size of the component CSS.
"auto"
component.sass.cssInlineLimitSize limit at which to switch from inline to auto behavior (when cssBuildMode is auto)8192
optimization.sourcemapsEnable or disable sourcemaps.
One of:
  • undefined: Never build sourcemaps
  • "dev": Include sourcemaps in dev builds.
  • "always": Include sourcemaps in dev and production builds.
undefined
optimization.cwvOverlayEnables or disable the CWV overlay.
One of:
  • true: CWV overlay enabled
  • false: CWV overlay disabled
true
optimization.minifyEnables or disable minification.
One of:
  • "production": In production builds only
  • "always": In production and dev builds
  • "never": Disable minification
"production"
optimization.previewBarShow or hide the Shopify theme preview bar
One of:
  • undefined: Default behavior
  • "block": Hide the preview bar
  • "mini": Replace the preview bar with a smaller version w/ direct preview link.
undefined
optimization.preloaderOne of:
  • undefined: Don't include a preloader
  • "blank": Include a white overlay preloader.
  • "pseudo"
undefined
optimization.preloaderDelayMaximum time to show the preloader200
optimization.preloadComponentsArray of components to always load immediately. Use this to specify above-the-fold global components.[]
optimization.eagerComponentPreloadingAttempt to determine which components to preload from Liquid.false
optimization.iconsEnables optimization of SVG icons
optimization.icons.convertToCurrentColorConverts all colors in SVG icons to currentColortrue
optimization.devBuildReminderShows reminders against publishing themes build in dev mode.
One of:
  • "enforce": Show, block publishing
  • "gentle": Show, don't block publishing
  • "never": Never show reminder
"enforce"
optimization.includeCriticalCssWhether critical styles are included in the theme output
One of:
  • "always": Include critical CSS
  • "only": Include only critical CSS, omitting all non-critical CSS
  • "never": Do not include critical CSS
"always"
extendViteExtend the underlying Vite config.
Type: extendVite(config: UserConfig): UserConfig
undefined
depCheck.ignoreArray of package names to exclude from dependency validation[]

Type hinting

The type for the expected config exported from salvo.config.js is made available at @eastsideco/salvo-ts-build/schemas/config. You can reference this in a comment in your salvo.config.js file in order to see helpful descriptions of configuration settings and receive feedback in your editor when the config is incorrect.

To enable type hinting include an @type comment on the config object you export and a // @ts-check comment as the first line of the file:

salvo.config.js
js
// @ts-check
const path = require('path');
 
/** @type {import('@eastsideco/salvo-ts-build/schema/config').SalvoConfig} */
const config = {
buildVariant: null,
entry: ['./src/main.ts'],
css: ['./assets/styles/theme.scss'],
output: {
themeJs: 'theme.min.js',
themeCss: 'theme.css.liquid',
themeMetadata: 'theme.metadata.js',
},
extraCss: [],
components: {
sass: {
defaultImports: [],
cssBuildMode: 'inline',
(property) cssBuildMode?: CssBuildMode | undefined
},
},
alias: {
},
polyfills: [],
enableLegacySalvoLiteComponentSupport: false,
extendVite(config) {
},
optimization: {
previewBar: 'small'
Type '"small"' is not assignable to type '"block" | "mini" | undefined'.2322Type '"small"' is not assignable to type '"block" | "mini" | undefined'.
}
};
 
module.exports = config;
salvo.config.js
js
// @ts-check
const path = require('path');
 
/** @type {import('@eastsideco/salvo-ts-build/schema/config').SalvoConfig} */
const config = {
buildVariant: null,
entry: ['./src/main.ts'],
css: ['./assets/styles/theme.scss'],
output: {
themeJs: 'theme.min.js',
themeCss: 'theme.css.liquid',
themeMetadata: 'theme.metadata.js',
},
extraCss: [],
components: {
sass: {
defaultImports: [],
cssBuildMode: 'inline',
(property) cssBuildMode?: CssBuildMode | undefined
},
},
alias: {
},
polyfills: [],
enableLegacySalvoLiteComponentSupport: false,
extendVite(config) {
},
optimization: {
previewBar: 'small'
Type '"small"' is not assignable to type '"block" | "mini" | undefined'.2322Type '"small"' is not assignable to type '"block" | "mini" | undefined'.
}
};
 
module.exports = config;

Due to a Typescript bug this will not work if you specify the @type comment on a direct assignment to module.exports. Instead, you need to use an intermediary variable as shown in the example above:

salvo.config.js
ts
// @ts-check
 
// This will not work
 
/** @type {import('@eastsideco/salvo-ts-build/schema/config').SalvoConfig} */
module.exports = {
// ...
};
salvo.config.js
ts
// @ts-check
 
// This will not work
 
/** @type {import('@eastsideco/salvo-ts-build/schema/config').SalvoConfig} */
module.exports = {
// ...
};