2021-10-09 10:09:06 +00:00
|
|
|
import './minify.css'
|
2022-11-28 14:34:13 +00:00
|
|
|
import './imported.css'
|
|
|
|
import './sugarss.sss'
|
|
|
|
import './sass.scss'
|
|
|
|
import './less.less'
|
|
|
|
import './stylus.styl'
|
2023-11-11 15:00:12 +00:00
|
|
|
import './manual-chunk.css'
|
2021-10-09 10:09:06 +00:00
|
|
|
|
2024-01-12 09:07:22 +00:00
|
|
|
import urlCss from './url-imported.css?url'
|
|
|
|
appendLinkStylesheet(urlCss)
|
|
|
|
|
2022-03-25 22:47:44 +00:00
|
|
|
import rawCss from './raw-imported.css?raw'
|
|
|
|
text('.raw-imported-css', rawCss)
|
|
|
|
|
2020-12-22 20:34:02 +00:00
|
|
|
import mod from './mod.module.css'
|
2021-02-05 15:48:50 +00:00
|
|
|
document.querySelector('.modules').classList.add(mod['apply-color'])
|
2020-12-22 20:34:02 +00:00
|
|
|
text('.modules-code', JSON.stringify(mod, null, 2))
|
|
|
|
|
|
|
|
import sassMod from './mod.module.scss'
|
2021-02-05 15:48:50 +00:00
|
|
|
document.querySelector('.modules-sass').classList.add(sassMod['apply-color'])
|
2020-12-22 20:34:02 +00:00
|
|
|
text('.modules-sass-code', JSON.stringify(sassMod, null, 2))
|
|
|
|
|
2024-03-12 13:13:13 +00:00
|
|
|
import { a as treeshakeMod } from './treeshake-module/index.js'
|
|
|
|
document
|
|
|
|
.querySelector('.modules-treeshake')
|
|
|
|
.classList.add(treeshakeMod()['treeshake-module-a'])
|
|
|
|
|
2021-07-31 14:02:34 +00:00
|
|
|
import composesPathResolvingMod from './composes-path-resolving.module.css'
|
|
|
|
document
|
|
|
|
.querySelector('.path-resolved-modules-css')
|
|
|
|
.classList.add(...composesPathResolvingMod['path-resolving-css'].split(' '))
|
|
|
|
document
|
|
|
|
.querySelector('.path-resolved-modules-sass')
|
|
|
|
.classList.add(...composesPathResolvingMod['path-resolving-sass'].split(' '))
|
|
|
|
document
|
|
|
|
.querySelector('.path-resolved-modules-less')
|
|
|
|
.classList.add(...composesPathResolvingMod['path-resolving-less'].split(' '))
|
|
|
|
text(
|
|
|
|
'.path-resolved-modules-code',
|
|
|
|
JSON.stringify(composesPathResolvingMod, null, 2),
|
|
|
|
)
|
|
|
|
|
2022-04-04 10:21:02 +00:00
|
|
|
import inlineMod from './inline.module.css?inline'
|
|
|
|
text('.modules-inline', inlineMod)
|
|
|
|
|
2022-11-28 14:34:13 +00:00
|
|
|
import charset from './charset.css?inline'
|
2022-04-11 18:13:37 +00:00
|
|
|
text('.charset-css', charset)
|
|
|
|
|
2022-08-31 14:58:43 +00:00
|
|
|
import './layered/index.css'
|
|
|
|
|
2021-02-04 21:37:50 +00:00
|
|
|
import './dep.css'
|
2021-06-08 07:06:43 +00:00
|
|
|
import './glob-dep.css'
|
2021-02-04 21:37:50 +00:00
|
|
|
|
2024-06-18 07:04:59 +00:00
|
|
|
// eslint-disable-next-line import-x/order
|
2022-07-01 03:17:19 +00:00
|
|
|
import { barModuleClasses } from '@vitejs/test-css-js-dep'
|
|
|
|
document
|
|
|
|
.querySelector('.css-js-dep-module')
|
|
|
|
.classList.add(barModuleClasses.cssJsDepModule)
|
|
|
|
|
2020-12-22 20:34:02 +00:00
|
|
|
function text(el, text) {
|
|
|
|
document.querySelector(el).textContent = text
|
|
|
|
}
|
|
|
|
|
2024-01-12 09:07:22 +00:00
|
|
|
function appendLinkStylesheet(href) {
|
|
|
|
const link = document.createElement('link')
|
|
|
|
link.rel = 'stylesheet'
|
|
|
|
link.href = href
|
|
|
|
document.head.appendChild(link)
|
|
|
|
}
|
|
|
|
|
2020-12-22 20:34:02 +00:00
|
|
|
if (import.meta.hot) {
|
|
|
|
import.meta.hot.accept('./mod.module.css', (newMod) => {
|
|
|
|
const list = document.querySelector('.modules').classList
|
|
|
|
list.remove(mod.applyColor)
|
|
|
|
list.add(newMod.applyColor)
|
|
|
|
text('.modules-code', JSON.stringify(newMod.default, null, 2))
|
|
|
|
})
|
|
|
|
|
|
|
|
import.meta.hot.accept('./mod.module.scss', (newMod) => {
|
|
|
|
const list = document.querySelector('.modules-sass').classList
|
|
|
|
list.remove(mod.applyColor)
|
|
|
|
list.add(newMod.applyColor)
|
|
|
|
text('.modules-sass-code', JSON.stringify(newMod.default, null, 2))
|
|
|
|
})
|
|
|
|
}
|
2020-12-30 23:47:35 +00:00
|
|
|
|
|
|
|
// async
|
|
|
|
import('./async')
|
|
|
|
|
|
|
|
if (import.meta.env.DEV) {
|
|
|
|
import('./async-treeshaken')
|
|
|
|
}
|
2021-07-23 02:00:23 +00:00
|
|
|
|
|
|
|
// inlined
|
|
|
|
import inlined from './inlined.css?inline'
|
|
|
|
text('.inlined-code', inlined)
|
2022-02-20 13:46:26 +00:00
|
|
|
|
|
|
|
// glob
|
2022-11-28 14:34:13 +00:00
|
|
|
const glob = import.meta.glob('./glob-import/*.css', { query: '?inline' })
|
2022-05-08 08:16:44 +00:00
|
|
|
Promise.all(
|
|
|
|
Object.keys(glob).map((key) => glob[key]().then((i) => i.default)),
|
|
|
|
).then((res) => {
|
2022-02-20 13:46:26 +00:00
|
|
|
text('.imported-css-glob', JSON.stringify(res, null, 2))
|
|
|
|
})
|
|
|
|
|
|
|
|
// globEager
|
2022-11-28 14:34:13 +00:00
|
|
|
const globEager = import.meta.glob('./glob-import/*.css', {
|
|
|
|
eager: true,
|
|
|
|
query: '?inline',
|
|
|
|
})
|
2022-02-20 13:46:26 +00:00
|
|
|
text('.imported-css-globEager', JSON.stringify(globEager, null, 2))
|
2022-05-04 08:50:44 +00:00
|
|
|
|
2023-08-16 11:54:32 +00:00
|
|
|
import postcssSourceInput from './postcss-source-input.css?inline&query=foo'
|
2022-05-04 08:50:44 +00:00
|
|
|
text('.postcss-source-input', postcssSourceInput)
|
2022-07-01 03:08:47 +00:00
|
|
|
|
2022-12-12 19:12:53 +00:00
|
|
|
// The file is jsfile.css.js, and we should be able to import it without extension
|
|
|
|
import jsFileMessage from './jsfile.css'
|
|
|
|
text('.jsfile-css-js', jsFileMessage)
|
|
|
|
|
2022-12-14 06:28:45 +00:00
|
|
|
import '#alias'
|
|
|
|
import aliasContent from '#alias?inline'
|
2022-07-01 03:08:47 +00:00
|
|
|
text('.aliased-content', aliasContent)
|
|
|
|
import aliasModule from '#alias-module'
|
|
|
|
document
|
|
|
|
.querySelector('.aliased-module')
|
|
|
|
.classList.add(aliasModule.aliasedModule)
|
2022-07-19 06:48:12 +00:00
|
|
|
|
|
|
|
import './unsupported.css'
|
2022-09-22 09:10:42 +00:00
|
|
|
|
|
|
|
import './async/index'
|
2023-04-07 18:02:39 +00:00
|
|
|
|
|
|
|
import('./same-name/sub1/sub')
|
|
|
|
import('./same-name/sub2/sub')
|
2024-02-20 13:07:48 +00:00
|
|
|
|
|
|
|
import './imports-imports-field.css'
|