@@ -4,6 +4,17 @@ var _ = require('lodash'),
4
4
5
5
var exports = { } ;
6
6
7
+ function checkTagExistence ( file , parts , settings ) {
8
+ if ( _ . has ( parts , settings . tagName ) || _ . has ( parts , settings . fileType ) ) {
9
+ var type = settings . tagName || settings . fileType ;
10
+ throw new TypeError ( `File "${ file } " can't be used as "${ type } ", because it was already defined in "${ _ . get ( parts [ type ] , 'file' , null ) } ".` ) ;
11
+ }
12
+ }
13
+
14
+ function prepareTag ( ) {
15
+
16
+ }
17
+
7
18
exports . addTag = function addTag ( tags , tagName , attributes ) {
8
19
tags . push ( tag ( {
9
20
name : tagName ,
@@ -62,16 +73,18 @@ exports.resolveOptions = function resolveOptions(options, defaultOptions) {
62
73
} ;
63
74
64
75
exports . createPart = function createPart ( settings , options ) {
76
+ var attributes = _ . assign ( { } , {
77
+ separated : true ,
78
+ src : path . join ( settings . dirPath , settings . file ) ,
79
+ scoped : settings . tagName === 'style' && settings . scoped ,
80
+ lang : settings . tagName ? settings . fileType : false
81
+ } , options . global , options [ settings . fileType ] || { } , options [ settings . tagName ] || { } ) ;
82
+
65
83
return {
66
84
name : settings . tagName || settings . fileType ,
67
85
file : settings . file ,
68
86
fileName : settings . fileName ,
69
- attributes : _ . assign ( { } , {
70
- separated : true ,
71
- src : path . join ( settings . dirPath , settings . file ) ,
72
- scoped : settings . tagName === 'style' && settings . scoped ,
73
- lang : settings . tagName ? settings . fileType : false
74
- } , options . global , options [ settings . fileType ] || { } , options [ settings . tagName ] || { } )
87
+ attributes : attributes
75
88
} ;
76
89
} ;
77
90
@@ -87,10 +100,7 @@ exports.createParts = function createParts(options, dirPath, inputFile, fileName
87
100
88
101
var settings = that . parseFile ( options , dirPath , file ) ;
89
102
90
- if ( _ . has ( parts , settings . tagName ) || _ . has ( parts , settings . fileType ) ) {
91
- var type = settings . tagName || settings . fileType ;
92
- throw new TypeError ( `File "${ file } " can't be used as "${ type } ", because it was already defined in "${ _ . get ( parts [ type ] , 'file' , null ) } ".` ) ;
93
- }
103
+ checkTagExistence ( file , parts , settings ) ;
94
104
95
105
parts [ settings . tagName || settings . fileType ] = that . createPart ( settings , options ) ;
96
106
} ) ;
0 commit comments