33const fs = require ( 'fs' ) ;
44const camelCase = require ( 'camel-case' ) ;
55const compiler = require ( 'vue-template-compiler' ) ;
6- const CleanCSS = require ( 'clean-css' ) ;
76const styleParser = require ( './style' ) ;
87const htmlParser = require ( './html' ) ;
98const scriptParser = require ( './script' ) ;
@@ -28,13 +27,14 @@ function componentParser(templatePath: string, defaults: Object, type: string, C
2827 let error = `Could Not Find Component, I was expecting it to live here \n${ templatePath } \nBut I couldn't find it there, ¯\\_(ツ)_/¯\n\n` ;
2928 reject ( error ) ;
3029 } else {
31- parseContent ( content , templatePath , defaults , type , Cache ) . then ( contentObject => {
30+ parseContent ( content , templatePath , defaults , type , Cache )
31+ . then ( contentObject => {
3232 // set the cache for the component
33- Cache . set ( templatePath , contentObject ) ;
34- resolve ( contentObject ) ;
35- } ) . catch ( error => {
36- reject ( error ) ;
37- } ) ;
33+ Cache . set ( templatePath , contentObject ) ;
34+ resolve ( contentObject ) ;
35+ } ) . catch ( error => {
36+ reject ( error ) ;
37+ } ) ;
3838 }
3939 } ) ;
4040 }
@@ -66,11 +66,10 @@ function parseContent(content: string, templatePath: string, defaults: Object, t
6666 Promise . all ( promiseArray ) . then ( resultsArray => {
6767 const template = resultsArray [ 0 ] ;
6868 const script = resultsArray [ 1 ] ;
69- let style = '' ;
70- if ( resultsArray [ 2 ] ) {
71- style = resultsArray [ 2 ] ;
69+ if ( defaults . style === undefined ) {
70+ defaults . style = resultsArray [ 2 ] ;
7271 } else {
73- style = new CleanCSS ( { } ) . minify ( resultsArray [ 1 ] . styles ? resultsArray [ 1 ] . styles : '' ) . styles ;
72+ defaults . style += resultsArray [ 2 ] ;
7473 }
7574
7675 script . template = template ;
@@ -79,7 +78,7 @@ function parseContent(content: string, templatePath: string, defaults: Object, t
7978 template : template ,
8079 parsedContent : parsedContent ,
8180 type : type ,
82- style : style ,
81+ style : defaults . style ,
8382 name : camelCase ( templateName ) ,
8483 script : script
8584 } ;
0 commit comments