From ba0e274f8eff8165fe05aa4870d7f555a6ee1ec0 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Mon, 7 May 2018 02:13:18 +0530 Subject: [PATCH] feat: Change visibilty of compileStyle and compileTemplate methods to public --- src/compiler.ts | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 2b45e6f..ecbc874 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -94,7 +94,9 @@ export class SFCCompiler { const template = descriptor.template && this.compileTemplate(filename, descriptor.template) - const styles = descriptor.styles.map(style => this.compileStyle(filename, scopeId, style)) + const styles = descriptor.styles.map(style => + this.compileStyle(filename, scopeId, style) + ) const { script: rawScript, customBlocks } = descriptor const script = rawScript && { @@ -113,7 +115,10 @@ export class SFCCompiler { } } - private compileTemplate(filename: string, template: SFCBlock) { + compileTemplate( + filename: string, + template: SFCBlock + ): TemplateCompileResult & { functional: boolean } { const { preprocessOptions, ...options } = this.template const functional = 'functional' in template.attrs @@ -136,18 +141,23 @@ export class SFCCompiler { } } - private compileStyle(filename: string, scopeId: string, style: SFCBlock) { + compileStyle( + filename: string, + scopeId: string, + style: SFCBlock + ): StyleCompileResult { let tokens = undefined - const needsCSSModules = style.module === true || typeof style.module === 'string' + const needsCSSModules = + style.module === true || typeof style.module === 'string' const postcssPlugins = [ needsCSSModules ? postcssModules({ - generateScopedName: '[path][local]-[hash:base64:4]', - ...this.style.postcssModulesOptions, - getJSON: (t: any) => { - tokens = t - } - }) + generateScopedName: '[path][local]-[hash:base64:4]', + ...this.style.postcssModulesOptions, + getJSON: (t: any) => { + tokens = t + } + }) : undefined, this.template.isProduction ? postcssClean(this.style.postcssCleanOptions) @@ -165,10 +175,10 @@ export class SFCCompiler { postcssOptions: this.style.postcssOptions, preprocessLang: style.lang, preprocessOptions: - (style.lang && - this.style.preprocessOptions && - this.style.preprocessOptions[style.lang]) || - {}, + (style.lang && + this.style.preprocessOptions && + this.style.preprocessOptions[style.lang]) || + {}, trim: this.style.trim }) 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