Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit c505f94

Browse files
authored
feat: Change visibilty of compileStyle and compileTemplate methods to public (#66)
1 parent c03a6ac commit c505f94

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

src/compiler.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ export class SFCCompiler {
9494
const template =
9595
descriptor.template && this.compileTemplate(filename, descriptor.template)
9696

97-
const styles = descriptor.styles.map(style => this.compileStyle(filename, scopeId, style))
97+
const styles = descriptor.styles.map(style =>
98+
this.compileStyle(filename, scopeId, style)
99+
)
98100

99101
const { script: rawScript, customBlocks } = descriptor
100102
const script = rawScript && {
@@ -113,7 +115,10 @@ export class SFCCompiler {
113115
}
114116
}
115117

116-
private compileTemplate(filename: string, template: SFCBlock) {
118+
compileTemplate(
119+
filename: string,
120+
template: SFCBlock
121+
): TemplateCompileResult & { functional: boolean } {
117122
const { preprocessOptions, ...options } = this.template
118123
const functional = 'functional' in template.attrs
119124

@@ -136,18 +141,23 @@ export class SFCCompiler {
136141
}
137142
}
138143

139-
private compileStyle(filename: string, scopeId: string, style: SFCBlock) {
144+
compileStyle(
145+
filename: string,
146+
scopeId: string,
147+
style: SFCBlock
148+
): StyleCompileResult {
140149
let tokens = undefined
141-
const needsCSSModules = style.module === true || typeof style.module === 'string'
150+
const needsCSSModules =
151+
style.module === true || typeof style.module === 'string'
142152
const postcssPlugins = [
143153
needsCSSModules
144154
? postcssModules({
145-
generateScopedName: '[path][local]-[hash:base64:4]',
146-
...this.style.postcssModulesOptions,
147-
getJSON: (t: any) => {
148-
tokens = t
149-
}
150-
})
155+
generateScopedName: '[path][local]-[hash:base64:4]',
156+
...this.style.postcssModulesOptions,
157+
getJSON: (t: any) => {
158+
tokens = t
159+
}
160+
})
151161
: undefined,
152162
this.template.isProduction
153163
? postcssClean(this.style.postcssCleanOptions)
@@ -165,10 +175,10 @@ export class SFCCompiler {
165175
postcssOptions: this.style.postcssOptions,
166176
preprocessLang: style.lang,
167177
preprocessOptions:
168-
(style.lang &&
169-
this.style.preprocessOptions &&
170-
this.style.preprocessOptions[style.lang]) ||
171-
{},
178+
(style.lang &&
179+
this.style.preprocessOptions &&
180+
this.style.preprocessOptions[style.lang]) ||
181+
{},
172182
trim: this.style.trim
173183
})
174184

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy