@@ -9,7 +9,8 @@ let Importer = function() {
99 this . dirCSS = "" ;
1010 this . dirJS = "" ;
1111 this . layoutFile = "" ;
12-
12+ this . ignoreViews = [ ] ;
13+
1314 this . typeCSS = "" ;
1415 this . typeJS = "" ;
1516
@@ -115,7 +116,8 @@ let Importer = function() {
115116
116117 // Layout is not a view
117118 if ( view !== this . layoutFile &&
118- view . includes ( ".html" ) !== false
119+ view . includes ( ".html" ) !== false &&
120+ ! this . ignoreViews . includes ( view )
119121 ) {
120122
121123 // Load the file
@@ -130,23 +132,39 @@ let Importer = function() {
130132 }
131133
132134 // Parse for images
133- payload . import . dirImages = this . fixFilename ( "" , this . dirImages ) ;
134- payload . import . images = fs . readdirSync ( payload . import . dirImages ) ;
135+ let imgdir = this . fixFilename ( "" , this . dirImages ) ;
136+ if ( fs . existsSync ( imgdir ) ) {
137+ payload . import . dirImages = imgdir ;
138+ payload . import . images = fs . readdirSync ( payload . import . dirImages ) ;
139+ }
135140
136141 // Parse for css
137- payload . import . dirCSS = this . fixFilename ( "" , this . dirCSS ) ;
138- payload . import . typeCSS = this . typeCSS ;
139- payload . import . css = this . readdirFiletype ( this . dirCSS , this . typeCSS ) ;
142+ let cssdir = this . fixFilename ( "" , this . dirCSS ) ;
143+ if ( fs . existsSync ( cssdir ) ) {
144+ payload . import . dirCSS = cssdir ;
145+ payload . import . typeCSS = this . typeCSS ;
146+ payload . import . css = this . readdirFiletype ( this . dirCSS , this . typeCSS ) ;
147+ }
140148
141149 // Parse for js
142- payload . import . dirJS = this . fixFilename ( "" , this . dirJS ) ;
143- payload . import . typeJS = this . typeJS ;
144- payload . import . js = this . readdirFiletype ( this . dirJS , this . typeJS ) ;
150+ let jsdir = this . fixFilename ( "" , this . dirJS ) ;
151+ if ( fs . existsSync ( jsdir ) ) {
152+ payload . import . dirJS = jsdir ;
153+ payload . import . typeJS = this . typeJS ;
154+ payload . import . js = this . readdirFiletype ( this . dirJS , this . typeJS ) ;
155+ }
145156
146157 console . log ( "\t" + loadFunctions . length + " views (including layouts)" ) ;
147- console . log ( "\t" + payload . import . images . length + " images" ) ;
148- console . log ( "\t" + payload . import . css . length + " " + this . typeCSS + " files" ) ;
149- console . log ( "\t" + payload . import . js . length + " " + this . typeJS + " files" ) ;
158+
159+ if ( payload . import . images ) {
160+ console . log ( "\t" + payload . import . images . length + " images" ) ;
161+ }
162+ if ( payload . import . css ) {
163+ console . log ( "\t" + payload . import . css . length + " " + this . typeCSS + " files" ) ;
164+ }
165+ if ( payload . import . js ) {
166+ console . log ( "\t" + payload . import . js . length + " " + this . typeJS + " files" ) ;
167+ }
150168
151169 // Load layout file
152170 Promise . all ( loadFunctions )
0 commit comments