04.07.2019 Views

frontend-developer-1

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Customize and Create JavaScript<br />

• Determine if there are any overrides for the alias.<br />

• Map these files to the directory path as described above.<br />

Demonstrate that you understand how to create and configure<br />

Magento JavaScript mixins.<br />

Let’s look at an example of how to create a mixin and override an existing module’s<br />

functionality.<br />

We need to update functionality in: https://magento.test/static/version1/<strong>frontend</strong>/<br />

SwiftOtter/Flex/en_US/Magento_Catalog/js/gallery.js<br />

This file is pub/static/<strong>frontend</strong>/SwiftOtter/Flex/en_US/Magento_<br />

Catalog/js/gallery.js<br />

Its source file is vendor/magento/module-catalog/view/<strong>frontend</strong>/web/js/gallery.js<br />

Add the following to your requirejs-config.js file:<br />

// app/code/SwiftOtter/Flex/view/requirejs-config.js<br />

var config = {<br />

"config": {<br />

"mixins": {<br />

"Magento_Catalog/js/price-utils": {<br />

Copyright © 2018, SwiftOtter, Inc.<br />

81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!