2

Can Sencha Cmd be tuned for newer js features or replaced by other minifiers/optimizers? Or support coming with the latest versions anyway?

Benjamin E.
  • 5,042
  • 5
  • 38
  • 65

1 Answers1

2

Since the version has not been clarified, I will describe for 4.2.6

  1. Go to root of your project and run
npm init
  1. Install babel:
npm install --save-dev  babel-cli babel-preset-es2015
  1. Add to your package.json run scripts:
"scripts" : {
    "build-prod": "./node_modules/.bin/babel es6 -d app --comments=false --compact=true",
    "build-debug": "./node_modules/.bin/babel es6 -d app --sourceMaps=true",
    "watch": "./node_modules/.bin/babel es6 -d app --watch"
  },
  1. Move source code from app and app.js to another folder (for example call it es6)
mv app.js app
mv app es6
  1. and create build.xml in root and paste new task into project tag:
    <target name="-before-build">
        <x-shell reloadprofile="true" dir="${basedir}">
            npm run build-debug
        </x-shell>
    </target>
pvlt
  • 1,843
  • 1
  • 10
  • 19
  • The renaming part makes it a manual process, any way to fully automate? – Benjamin E. Jan 13 '20 at 11:38
  • I'm on Cmd 6.5.3 but could upgrade to anything newer – Benjamin E. Jan 13 '20 at 11:38
  • Why it's makes it process manual? But It doesn't matter, because version 6.5 support es6 from scratch https://www.sencha.com/blog/announcing-ext-js-6-5-and-sencha-cmd-6-5-ga/ https://www.sencha.com/blog/getting-started-with-es2015-using-sencha-cmd-6-5/ – pvlt Jan 13 '20 at 12:10
  • 1
    Not object destructuring, which is a bummer since it's a nice js enhancement :) – Benjamin E. Jan 14 '20 at 02:15
  • Got it, i agree it's good feature. Then return to my question. Why renaming part makes it process manual? We just create new source folder for babel, old folder (app) is a destination. In the same time old folder (app) is source folder for Sencha CMD. So we get automate pipeline. P.S. In my manual one step was unnecessary – pvlt Jan 14 '20 at 07:59