Skip to content

Commit

Permalink
wip: Dedupe CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Nov 29, 2022
1 parent 0f280b8 commit 8306d4c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/design-system/src/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@
@import "theme/oc-visibility";
@import "theme/oc-width";
@import "theme/tooltip";

/* SHITTY MARKER */
2 changes: 2 additions & 0 deletions packages/web-runtime/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
</div>
</template>
<script lang="ts">
import '../../design-system/src/styles/styles.scss'
import { mapGetters, mapState, mapActions } from 'vuex'
import SkipTo from './components/SkipTo.vue'
import LayoutApplication from './layouts/Application.vue'
Expand Down
12 changes: 12 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ const __filename = fileURLToPath(import.meta.url)
const projectRootDir = dirname(__filename)

const plugins = [
{
transform(src, id) {
if (id.includes('rollup-plugin-vue=styles')) {
const split = src.split('/* SHITTY MARKER */')
const newSrc = split[split.length-1]
return {
code: newSrc,
map: null
}
}
}
},
postcss({
extract: path.join('css', 'web.css'),
minimize: production,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
'^.+\\.vue$': '@vue/vue2-jest'
},
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/tests/unit/stubs/empty.js',
'\\.(css|less|scss)$': '<rootDir>/tests/unit/stubs/empty.js',
'^@/(.*)$': '<rootDir>/$1',
'core-js': '<rootDir>/node_modules/core-js',

Expand Down

0 comments on commit 8306d4c

Please sign in to comment.