Code Monkey home page Code Monkey logo

es6-demo's Introduction

babel 使用方法

npm install
npm run build
npm run browser
npm run ugly

npm run build

babel src -d dist

通过 babel 和 babel-preset-2015 把 es6 转成 es5

npm run browser

browserify dist/app.js -o bundle.js

通过 browserify 把 node 环境中的模块化的脚本转成浏览器环境的单一脚本

npm run ugly

uglifyjs bundle.js -c -o bundle.min.js

通过 uglifyjs 把 bundle.js 压缩 为 bundle.min.js

index.html 中最终引入的是 bundle.min.js

脚本更新

每次更新了 src 中的脚本后,都需要重复执行以上步骤。

也可以使用 webpack 监听文件变化自动执行。

es6-demo's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.