@@ -244,7 +244,7 @@ public function compileScss($disableEvents = false)
244244 {
245245 $ cssSourceMap = $ this ->config ['compile ' ]['css ' ];
246246
247- if ($ disableEvents === false ) {
247+ if ($ disableEvents !== true ) {
248248 $ event = new \Cake \Event \Event ('Elephfront.Scss.beforeCompile ' , $ this , [
249249 'sourceMap ' => $ cssSourceMap ,
250250 'config ' => $ this ->config
@@ -259,7 +259,7 @@ public function compileScss($disableEvents = false)
259259 ->taskCssMinify ()
260260 ->run ();
261261
262- if ($ disableEvents === false ) {
262+ if ($ disableEvents !== true ) {
263263 $ event = new \Cake \Event \Event ('Elephfront.Scss.afterCompile ' , $ this , [
264264 'sourceMap ' => $ cssSourceMap ,
265265 'config ' => $ this ->config
@@ -271,19 +271,36 @@ public function compileScss($disableEvents = false)
271271 /**
272272 * Executes the compilation of JS assets
273273 *
274+ * @param bool $disableEvents Whether events should be dispatched or not. Default to false.
274275 * @return void
275276 */
276- public function compileJs ()
277+ public function compileJs ($ disableEvents = false )
277278 {
278279 $ jsSourceMap = $ this ->config ['compile ' ]['js ' ];
279280
281+ if ($ disableEvents !== true ) {
282+ $ event = new \Cake \Event \Event ('Elephfront.Js.beforeCompile ' , $ this , [
283+ 'sourceMap ' => $ jsSourceMap ,
284+ 'config ' => $ this ->config
285+ ]);
286+ $ this ->eventManager ()->dispatch ($ event );
287+ }
288+
280289 $ collection = $ this ->collectionBuilder ();
281290 $ collection
282291 ->taskImportJavascript ()
283292 ->setDestinationsMap ($ jsSourceMap )
284293 ->disableWriteFile ()
285294 ->taskJsMinify ()
286295 ->run ();
296+
297+ if ($ disableEvents !== true ) {
298+ $ event = new \Cake \Event \Event ('Elephfront.Js.afterCompile ' , $ this , [
299+ 'sourceMap ' => $ jsSourceMap ,
300+ 'config ' => $ this ->config
301+ ]);
302+ $ this ->eventManager ()->dispatch ($ event );
303+ }
287304 }
288305
289306 /**
0 commit comments