@@ -157,25 +157,47 @@ public function processFile(FileContainer $file)
157
157
{
158
158
switch ($ file ->getType ()) {
159
159
case FileContainer::TYPE_SCSS :
160
- try {
161
- $ this ->sass ->addImportPath (dirname ($ file ->getInputPath ()));
162
- $ content = $ this ->sass ->compile ($ file ->getInputContent ());
163
-
164
- return $ file ->setOutputContent ($ content );
165
- } catch (ParserException $ e ) {
166
- throw new CompilerException ($ e ->getMessage (), 1 , $ e );
167
- }
160
+ return $ this ->compileSCSS ($ file );
168
161
case FileContainer::TYPE_LESS :
169
- try {
170
- return $ file ->setOutputContent ($ this ->less ->compileFile ($ file ->getInputPath ()));
171
- } catch (\Exception $ e ) {
172
- throw new CompilerException ($ e ->getMessage (), 1 , $ e );
173
- }
162
+ return $ this ->compileLESS ($ file );
174
163
}
175
164
176
165
throw new CompilerException ('unknown compiler ' );
177
166
}
178
167
168
+ /**
169
+ * @param FileContainer $file
170
+ *
171
+ * @return $this
172
+ * @throws CompilerException
173
+ */
174
+ protected function compileSCSS (FileContainer $ file )
175
+ {
176
+ try {
177
+ $ this ->sass ->addImportPath (dirname ($ file ->getInputPath ()));
178
+ $ content = $ this ->sass ->compile ($ file ->getInputContent ());
179
+
180
+ return $ file ->setOutputContent ($ content );
181
+ } catch (ParserException $ e ) {
182
+ throw new CompilerException ($ e ->getMessage (), 1 , $ e );
183
+ }
184
+ }
185
+
186
+ /**
187
+ * @param FileContainer $file
188
+ *
189
+ * @return $this
190
+ * @throws CompilerException
191
+ */
192
+ protected function compileLESS (FileContainer $ file )
193
+ {
194
+ try {
195
+ return $ file ->setOutputContent ($ this ->less ->compileFile ($ file ->getInputPath ()));
196
+ } catch (\Exception $ e ) {
197
+ throw new CompilerException ($ e ->getMessage (), 1 , $ e );
198
+ }
199
+ }
200
+
179
201
/**
180
202
* @param string $formatter
181
203
*
0 commit comments