MCPcopy Create free account
hub / github.com/bigcommerce/stencil-cli / getCssAssembleTask

Method getCssAssembleTask

lib/stencil-bundle.js:105–145  ·  view source on GitHub ↗
(compiler)

Source from the content-addressed store, hash-verified

103 }
104
105 getCssAssembleTask(compiler) {
106 const assembleOptions = {
107 bundle: true,
108 };
109 return (callback) => {
110 let basePath;
111 if (compiler === 'css') {
112 basePath = path.join(this.themePath, 'assets/dist', compiler);
113 } else {
114 basePath = path.join(this.themePath, 'assets', compiler);
115 }
116 console.log('%s Parsing Started...', compiler.toUpperCase());
117 fs.readdir(basePath, (err, files) => {
118 const filterFiles = files.filter((file) => {
119 return file.substr(-(compiler.length + 1)) === `.${compiler}`;
120 });
121 async.map(
122 filterFiles,
123 async (file) => {
124 return stencilStyles.assembleCssFiles(
125 file,
126 basePath,
127 compiler,
128 assembleOptions,
129 );
130 },
131 (assemblingError, results) => {
132 const ret = {};
133 if (assemblingError) {
134 return callback(assemblingError);
135 }
136 filterFiles.forEach((file, index) => {
137 ret[file] = results[index];
138 });
139 console.log(`${'ok'.green} -- %s Parsing Finished`, compiler.toUpperCase());
140 return callback(null, ret);
141 },
142 );
143 });
144 };
145 }
146
147 /**
148 * helps to find any node modules dependencies with

Callers 2

constructorMethod · 0.95

Calls 1

logMethod · 0.80

Tested by

no test coverage detected