Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .storybook/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
RewriteEngine On

# If an existing asset or directory is requested, serve it
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html

<IfModule mod_headers.c>
<FilesMatch "\.(js|html)$">
Header set Cache-Control "no-cache"
</FilesMatch>

<FilesMatch "\.(css)$">
Header set Cache-Control "max-age=2592000, immutable"
</FilesMatch>

<FilesMatch "\.(svg|woff2)$">
Header set Cache-Control "max-age=31536000, immutable"
</FilesMatch>
</IfModule>
15 changes: 14 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy from 'rollup-plugin-copy';
import generateCem from '../cem/generate-cem-vite-plugin.js';
import { markdownIndexer } from '../src/stories/lib/markdown-indexer.js';
import { rollupMdToCsfPlugin } from '../src/stories/lib/markdown-to-csf.js';
Expand Down Expand Up @@ -64,7 +65,19 @@ const config = {

if (configType === 'PRODUCTION') {
customConfig = {
plugins: commonPlugins,
plugins: [
...commonPlugins,
// The clever cloud Storybook static app needs a `.htaccess` at the root of `storybook-static`
// @ts-expect-error type error related to the plugin but our usage matches the docs
copy({
targets: [
{
src: `.storybook/.htaccess`,
dest: config.build.outDir,
},
],
}),
],
};
}

Expand Down
111 changes: 0 additions & 111 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"preview:get": "node tasks/preview.js get",
"preview:list": "node tasks/preview.js list",
"preview:publish": "node tasks/preview.js publish",
"start": "static -H '{\"cache-control\": \"no-cache, no-store, must-revalidate\", \"Pragma\": \"no-cache\", \"Expires\": \"0\"}' -a 0.0.0.0 -p 8080 storybook-static",
"storybook:build": "storybook build -o storybook-static${STORYBOOK_PATH}",
"storybook:dev": "storybook dev -p 6006 --no-open",
"stylelint": "stylelint src/components/*/*.js",
Expand Down Expand Up @@ -131,7 +130,6 @@
"lit-analyzer": "2.0.0-pre.3",
"mime-types": "^2.1.30",
"mocha": "^10.0.0",
"node-static": "^0.7.11",
"postcss-styled-syntax": "^0.7.0",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^4.0.0",
Expand Down
Loading