MCPcopy
hub / github.com/vuejs/core / compileScoped

Function compileScoped

packages/compiler-sfc/__tests__/compileStyle.spec.ts:8–26  ·  view source on GitHub ↗
(
  source: string,
  options?: Partial<SFCStyleCompileOptions>,
)

Source from the content-addressed store, hash-verified

6import path from 'node:path'
7
8export function compileScoped(
9 source: string,
10 options?: Partial<SFCStyleCompileOptions>,
11): string {
12 const res = compileStyle({
13 source,
14 filename: 'test.css',
15 id: 'data-v-test',
16 scoped: true,
17 ...options,
18 })
19 if (res.errors.length) {
20 res.errors.forEach(err => {
21 console.error(err)
22 })
23 expect(res.errors.length).toBe(0)
24 }
25 return res.code
26}
27
28describe('SFC scoped CSS', () => {
29 test('simple selectors', () => {

Callers 1

Calls 3

compileStyleFunction · 0.90
forEachMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected