{"id":16788,"date":"2018-10-02T14:44:07","date_gmt":"2018-10-02T12:44:07","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=16788"},"modified":"2021-02-18T09:48:32","modified_gmt":"2021-02-18T07:48:32","slug":"the-integration-of-babel-and-post-css-in-magento-2","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html","title":{"rendered":"The Integration of Babel and Post CSS in Magento 2"},"content":{"rendered":"<p>Magento is a huge engine written by a large number of talented programmers. The problem is that due to its prevalence, they cannot make any serious changes without changing the major version.<\/p>\n<p><!--more-->Magento 2 was introduced in July 2015, when the ES5 features were not widely spread. Back then developers were using underscore for working with arrays, Knockout for data binding, and jQuery for working with DOM.<\/p>\n<p>In 2018, JS developers started using such ES7 features as:<\/p>\n<ul>\n<li>The declaration of variables via <strong>let<\/strong> and <strong>const<\/strong> instead of <strong>var<\/strong><\/li>\n<li>Arrow Functions<\/li>\n<li><strong>Async<\/strong>, <strong>await<\/strong> and <strong>Promise<\/strong> instead of callback<\/li>\n<li>Destructive assignment, extension operator, array and objects iteration methods<\/li>\n<\/ul>\n<p>The situation with styles is similar, <strong>float<\/strong> was used for design implementation back then, while today you can use <strong>grid<\/strong>.<\/p>\n<p>The vast majority of Magento 2 sites still use outdated layout and scripting methods to support older browsers. And although the share of IE11 is only 1.35%, and IE10 0.14%, our customers want sites to be accessible to everyone, regardless of their browser.<\/p>\n<p>I&#8217;d like to make it clear that further instructions will help to use ES7 features and new CSS features in browsers older than IE11, since I believe it is not necessary to support IE10 in 2018.<\/p>\n<h2><strong><span style=\"color: #000000\">EcmaScript &gt;5<\/span><\/strong><\/h2>\n<p>For older browsers to be able to work with the new code standards, Babel needs to be integrated into the development process.<\/p>\n<p>First, you need to add Babel to the dependences of the project. To do this, run the following code in the directory of the project:<\/p>\n<pre>npm install --save-dev @babel\/core @babel\/preset-env<\/pre>\n<p>In order for Babel to know which files are subject to transpilation, you need to specify the javascript file mask in the <em>dev\/tools\/grunt\/configs\/themes.js<\/em> file.<\/p>\n<pre>mymegatheme: {\r\n&#160;&#160;&#160;area: 'frontend',\r\n&#160;&#160;&#160;name: 'BelVG\/mymegatheme',\r\n&#160;&#160;&#160;locale: 'en_US',\r\n&#160;&#160;&#160;babelFiles: [{\r\n&#160;&#160;&#160;&#160;&#160;expand: true,\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;cwd: 'js\/source\/',\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;src: ['**\/*.js'],\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;dest: 'js\/'\r\n&#160;&#160;&#160;}],\r\n&#160;&#160;&#160;files: [\r\n&#160;&#160;&#160;&#160;&#160;'css\/styles-m',\r\n&#160;&#160;&#160;&#160;&#160;'css\/styles-l'\r\n&#160;&#160;&#160;],\r\n&#160;&#160;&#160;dsl: 'less'\r\n},<\/pre>\n<p>Replace mymegatheme with the name of your theme, and BelVG with the vendor of the theme.<\/p>\n<p>Now we need to teach Grunt to interact with the declared files. To do this, add the following lines to the <em>dev\/tools\/grunt\/configs\/combo.js<\/em> file:<\/p>\n<pre>babelFiles: function (themeName) {\r\n&#160;&#160;&#160;var es6Files = [],\r\n&#160;&#160;&#160;ourTheme = theme[themeName],\r\n&#160;&#160;&#160;files = ourTheme.babelFiles;\r\n&#160;&#160;&#160;for (var i = 0; i &lt; files.length; i++) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (typeof files[i].src == 'undefined') {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;var path_collection = {};\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for (var target in files[i]) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;path_collection[refine_path(\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ourTheme,\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Target\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;)] = refine_path(\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ourTheme,\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Files[i][target]\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;); \r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;es6Files.push(path_collection);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;} else {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;files[i].cwd = refine_path(\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ourTheme,\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Files[i].cwd\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;files[i].dest = refine_path(\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ourTheme,\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Files[i].dest\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;es6Files.push(files[i]);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;}\r\n&#160;&#160;&#160;}\r\n&#160;&#160;&#160;return es6Files;\r\n},<\/pre>\n<p>It remains to teach Grunt to process the files. For this we create the <em>dev\/tools\/grunt\/configs\/babel.js<\/em> file and write the following there:<\/p>\n<pre>'use strict';\r\nvar combo &#160;= require('.\/combo'),\r\n&#160;&#160;&#160;themes = require('.\/themes'),\r\n&#160;&#160;&#160;_ &#160;&#160;= require('underscore');\r\nvar themeOptions = {};\r\n_.each(themes, function(theme, name) {\r\n&#160;&#160;&#160;if (typeof theme.babelFiles != \"undefined\") {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;themeOptions[name] = {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;files: combo.babelFiles(name)\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;};\r\n&#160;&#160;&#160;}\r\n});\r\nvar babelOptions = {\r\n&#160;&#160;&#160;options: {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;sourceMap: true,\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;presets: ['babel-preset-env']\r\n&#160;&#160;&#160;}\r\n};\r\nmodule.exports = _.extend(themeOptions, babelOptions);<\/pre>\n<p>Done, now you can write modern Javascript and forget about the support of older browsers.<\/p>\n<h2><strong><span style=\"color: #000000\">CSS Next<\/span><\/strong><\/h2>\n<p>Unfortunately, CSS does not have such a beautiful version name as JavaScript, so I borrowed this name from the PostCSS preset, although we will not use it.<\/p>\n<p>I should also point out that the proposed settings will use PostCSS as a postprocessor, as it was intended. Often I see it being used as a preprocessor, which violates the functions implied by the authors (the answer lies in the title).<\/p>\n<p>First, you need to install the plugin for Grunt and the preset for PostCSS:<\/p>\n<pre>npm install --save-dev grunt-postcss postcss-preset-env<\/pre>\n<p>Then you need to create a <em>dev\/tools\/grunt\/configs\/postcss.json<\/em> file and insert the following configuration there:<\/p>\n<pre>{\r\n&#160;&#160;&#160;\"options\": {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"map\": true\r\n&#160;&#160;&#160;},\r\n&#160;&#160;&#160;\"plugins\": {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\"postcss-preset-env\": {},\r\n&#160;&#160;&#160;&#160;},\r\n&#160;&#160;&#160;\"dist\": {\r\n&#160;&#160;&#160;&#160;&#160;\"src\": [\"pub\/static\/frontend\/*\/*\/*\/css\/*.css\"]\r\n&#160;&#160;&#160;}\r\n}<\/pre>\n<p>And finally, we create the <em>dev\/tools\/grunt\/configs\/postcss.js<\/em> file with the following content:<\/p>\n<pre>module.exports = function(grunt) {\r\n&#160;&#160;&#160;grunt.loadNpmTasks('grunt-postcss');\r\n&#160;&#160;&#160;grunt.registerTask('postcss-env', function (target) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;var currentTarget = target || 'dist';\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;var config = grunt.config.get('postcss');\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;if (target) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;config[target] = {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;src:\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;[\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'pub\/static\/frontend\/*\/' +\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;target +\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'\/*\/css\/*.css'\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;]\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;};\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;}\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;grunt.config.set('postcss', config);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;grunt.option('force', true);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;grunt.task.run('postcss:'+currentTarget);\r\n&#160;&#160;&#160;});\r\n};<\/pre>\n<p>Run the following command before the release:<\/p>\n<pre>grunt postcss-env<\/pre>\n<p>That&#8217;s it, thank you for your attention. Now you can write modern code and forget about the browser compatibility.<\/p>\n","protected":false},"excerpt":{"rendered":"Integrating Babel and Post CSS in Magento 2 for browser compatibility.","protected":false},"author":82,"featured_media":16790,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[491,389],"tags":[],"class_list":["post-16788","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-magento-2","category-magento2-development","post_format-post-format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"The integration of Babel and Post CSS in Magento 2 for browser compatibility. Babel and Post CSS allow developers to write modern code for all browser versions.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Andrey Litvin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#article\",\"name\":\"Integrating Babel and Post CSS in Magento 2 | BelVG Blog\",\"headline\":\"The Integration of Babel and Post CSS in Magento 2\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/The-Integration-of-Babel-and-Post-CSS-in-Magento-2.jpg\",\"width\":1110,\"height\":590,\"caption\":\"The Integration of Babel and Post CSS in Magento 2\"},\"datePublished\":\"2018-10-02T14:44:07+02:00\",\"dateModified\":\"2021-02-18T09:48:32+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":6,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#webpage\"},\"articleSection\":\"Magento 2, Magento 2 Development, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"name\":\"Magento 2 Development\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"position\":2,\"name\":\"Magento 2 Development\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#listItem\",\"name\":\"The Integration of Babel and Post CSS in Magento 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#listItem\",\"position\":3,\"name\":\"The Integration of Babel and Post CSS in Magento 2\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"name\":\"Magento 2 Development\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin\",\"name\":\"Andrey Litvin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e1a6e3c80cb940fddb65016d94b015cd951b4a8a9cd7227565131f28ea95c7a0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Andrey Litvin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html\",\"name\":\"Integrating Babel and Post CSS in Magento 2 | BelVG Blog\",\"description\":\"The integration of Babel and Post CSS in Magento 2 for browser compatibility. Babel and Post CSS allow developers to write modern code for all browser versions.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/The-Integration-of-Babel-and-Post-CSS-in-Magento-2.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html\\\/#mainImage\",\"width\":1110,\"height\":590,\"caption\":\"The Integration of Babel and Post CSS in Magento 2\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/the-integration-of-babel-and-post-css-in-magento-2.html#mainImage\"},\"datePublished\":\"2018-10-02T14:44:07+02:00\",\"dateModified\":\"2021-02-18T09:48:32+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Integrating Babel and Post CSS in Magento 2 | BelVG Blog","description":"The integration of Babel and Post CSS in Magento 2 for browser compatibility. Babel and Post CSS allow developers to write modern code for all browser versions.","canonical_url":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#article","name":"Integrating Babel and Post CSS in Magento 2 | BelVG Blog","headline":"The Integration of Babel and Post CSS in Magento 2","author":{"@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2018\/10\/The-Integration-of-Babel-and-Post-CSS-in-Magento-2.jpg","width":1110,"height":590,"caption":"The Integration of Babel and Post CSS in Magento 2"},"datePublished":"2018-10-02T14:44:07+02:00","dateModified":"2021-02-18T09:48:32+02:00","inLanguage":"en-US","commentCount":6,"mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#webpage"},"articleSection":"Magento 2, Magento 2 Development, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","name":"Magento 2 Development"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","position":2,"name":"Magento 2 Development","item":"https:\/\/belvg.com\/blog\/category\/magento2-development","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#listItem","name":"The Integration of Babel and Post CSS in Magento 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#listItem","position":3,"name":"The Integration of Babel and Post CSS in Magento 2","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","name":"Magento 2 Development"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author","url":"https:\/\/belvg.com\/blog\/author\/andrey-litvin","name":"Andrey Litvin","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/e1a6e3c80cb940fddb65016d94b015cd951b4a8a9cd7227565131f28ea95c7a0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Andrey Litvin"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#webpage","url":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html","name":"Integrating Babel and Post CSS in Magento 2 | BelVG Blog","description":"The integration of Babel and Post CSS in Magento 2 for browser compatibility. Babel and Post CSS allow developers to write modern code for all browser versions.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2018\/10\/The-Integration-of-Babel-and-Post-CSS-in-Magento-2.jpg","@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html\/#mainImage","width":1110,"height":590,"caption":"The Integration of Babel and Post CSS in Magento 2"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html#mainImage"},"datePublished":"2018-10-02T14:44:07+02:00","dateModified":"2021-02-18T09:48:32+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"16788","title":"Integrating Babel and Post CSS in Magento 2 | #site_title","description":"The integration of Babel and Post CSS in Magento 2 for browser compatibility. Babel and Post CSS allow developers to write modern code for all browser versions.","keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:37:03","updated":"2026-11-03 18:37:03"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/magento2-development\" title=\"Magento 2 Development\">Magento 2 Development<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tThe Integration of Babel and Post CSS in Magento 2\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"Magento 2 Development","link":"https:\/\/belvg.com\/blog\/category\/magento2-development"},{"label":"The Integration of Babel and Post CSS in Magento 2","link":"https:\/\/belvg.com\/blog\/the-integration-of-babel-and-post-css-in-magento-2.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/16788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=16788"}],"version-history":[{"count":-6,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/16788\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/16790"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=16788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=16788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=16788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}