, yyy}Uniform exposure or exposure, in the introduction of the object must be used to deconstruct the form of assignment.
Introduce the Use module:import
Default Exposed modules:import xxx from ‘模块路径/模块名‘
Other modulesimport {xxx, yyy} from ‘模块路径/模块名‘import * as module1 from ‘模块路径/模块名‘
Problem:Some browsers also do not directly recognize ES6 's modular syntax.It needs Babel to be used to convert ES6 to ES5, but t
', // output file name, development environment directly fixed the output name },devserver:{Contentbase: './dist ',//Specify the location where the service is open, in the Dist folderHistoryapifallback:true,//Do not jump, very useful in developing a single page application, it relies on the HTML5 history API, if set to true, any 404 response may need to be replaced by index.htmlInline:true,//real-time Refreshport:8000,//default 8080proxy:{//Agent Properties"/api": {Target: ' H
": "1.3.1", "Vue-datasource": "1.0.9", "Axios": "^0.15.3", "Vue-core-image-upload": "2.1.5", "Mockjs": "^1.0.1-beta3", "Babel-polyfill": "^6.23.0" }, "Devdependencies": {//Devdependencies Sets the dependency on development use."Autoprefixer": "^6.7.2",//is used to automatically add attribute prefixes to the CSS3 property."Babel-core": "^6.22.1",//Babel
and written to Package.json "Devdependencies";
using ES6Install Babel-loader:Install // install and write to Package.json "devdependencies";To install a transcoding rule:Install babel-preset-es2015--save-install --save-dev babel-preset-stage-0 Install --save-dev babel-preset-stage-1Install --save-dev
need to install Webpack-dev-server, Then configure the service information in the Webpack.config.js file,Description of each parameterLoaders: Webpack Most powerful function is a variety of loader, through the use of loader different rules, Webpack can be very powerful to invoke a variety of external scripts, and can implement a variety of different formats of the file processing, such as convert less sass for CSS, ES6, 7 Convert to es5 that the browser can recognize, and convert the JSX in the
plug-ins available for use:
compiling
Gulp-sass-Compiling the sass into CSS via Libsass
Gulp-ruby-sass-compiling sass into CSS via Ruby Sass
Gulp-compass-compiled into CSS via Ruby sass and Compasssass
Gulp-less-less compiled into CSS.
Gulp-stylus-stylus compiled into CSS.
Gulp-postcss-pipe CSS via POSTCSS processors with a single parse.
Gulp-coffee-coffeescript compiled into JavaScript.
Gulp-typescript-typescript compiled into JavaScript.
Gulp-react-facebook react JSX template compiled into J
;
}
B/a.css
. text{text-align:center;font-size:16px;font-weight:700}
And then look at the JS compression
var gulp = require (' gulp ');
var uglify =require (' gulp-uglify ');
Gulp.task (' Jsmin ', function () {
gulp.src (' a/a.js ').
pipe (Uglify ())
. Pipe (Gulp.dest (' B '))
})
The code doesn't go into detail, it's easy to see the results.
function Person (name,age) {
this.name = name;
This.age = age;
}
Compressed function person
(n,e) {this.name=n,this.age=e}
For es6 compatibility issues, many teams have developed a variety of Syntax Parsing and conversion tools to convert es6 syntax we have written into es5, which is equivalent to a translator between es6 and the browser. More common tool solutions include Babel, jsx, Traceur, es6-shim, etc. In addition, the browser itself is also faster compatible with the new features of es6, of which the most friendly to the new features of es6 are chrome and Firefox
Vue+webpack+babel environment to build GitHub addressHttps://github.com/haoyongliang/webpack-babel-Vue1. First to understand the Vue project structure
简单的目录结构:
|-index.html
|-main.js 入口文件
|-App.vue vue文件,官方推荐命名法
|-package.json 工程文件(项目依赖、名称、配置)npm init --yes 生成
|-webpack.config.js webpack配置文件
2. Specify the entry and output files in the Webpack.config.js
' logged at 1502536297412 (19:11:37 gmt+0800(CST)) [Xcuitest] ERROR:SDK' 9.3.5 ' is notinch List of Simctl SDKs at getdevices$ (/applications/appium.app/contents/resources/app/node_modules/appium/node_modules /NODE-SIMCTL/LIB/SIMCTL.JS:230:13) at TryCatch (/applications/appium.app/contents/resources/app/node_modules/ APPIUM/NODE_MODULES/BABEL-RUNTIME/REGENERATOR/RUNTIME.JS:67:40) at Generatorfunctionprototype.invoke [as _invoke] ( /applications/appiu
First, the initialization of the project
First make sure that your node version is >=4.0. And make sure yarn can work properly, about installing yarn, you can see here
Let's create an empty folder first yarn-react-webpack-seed , for example, and then enter the command:
Yarn Init
Yarn If there is no installation, the full use of NPM replacement is no problem.
The project initializes and package.json then fills in some basic information.
Next we start to install the dependencies,
the knowledge you need to understand.Webpack Home: http://webpack.github.io/Environment preparationnode. js and Git are essential tools, and NPM's version is better than the 3.x version, NPM 3.x provides more efficient package dependency management.Before using these two project templates, you need to install the Vue CLI and execute the following command to install the Vue CLINPM install-g VUE-CLIAfter installing the Vue CLI, we can create the project based on the vue-webpack-simple template an
Due to the needs of the interview, first of several sources of element source learning blog. Vue source code will also continue to update.
OK, now we're starting to learn element--'s most popular Vue UI framework. Package.json
I think that to see a front-end project, you must first look at Package.json this file. Compile Entry
Let's look at the compiled portal.
"Scripts": {
# Install dependent
"bootstrap": "yarn | | NPM i ",
# Build file
" Build:file ":" Node Build/bin/iconinit
1). Create a new Mynew-react-web folder;
2). CD mynew-react-web;
3). NPM init, there will be a Package.json file at this time;
Installation package dependencies:4). NPM Install Webpack webpack-dev-server--save-dev;
5). NPM Install Babel-core Babel-loader--save-dev;
6). NPM Install babel-preset-es2015 babel-preset-react
Table of Contents 1 Overview 1.1 reference 1.2 configuration and related preparations 1.2.1 language Settings 1.2.2 No security prompts 1.2.3 establish Yas Shortcut 1.2.4 Jar package path Settings 1.2.5 Preview Image 2 ditaa2.1 Reference 2.2 Implementation principle 2.3 DITAA use Description 2.4 Example 3 graphviz3.1 example 4 plantuml4.1 configuration 4.2 Example 5 acknowledgements overview Org drawing has the following related modules Artist-mode/picture-mode: generating ASCII graphs DITAA: Ge
|png|gif|bmp|jpeg) $/,use:url-loader? limit=4000name=[hash:8]-[name].[ EXT]' }, //If the picture is larger than the limit size it will not be resolved to Base64//name set whether to rename the picture, [name].[ EXT] is the name of the picture that keeps the introduction, [Hash:8]-[name]. [ext] is automatically before the original image of a random hash value, to prevent duplication of the picture ]}Introduction of Babel in 3.webpackFo
This article mainly introduces the use of React-router and webpack how to quickly build a react program, the following words not to say, interested can learn together.
Initializing a project
We first create an empty folder, then initialize the Package.json and fill in some basic information.
$ NPM Init
Next we start to install the dependencies, and my Package.json dependencies are as follows
"Devdependencies": {"
Babel": "^5.5
First, Nodejs installationI have related articles in my blog and I will not repeat them here.Second, the relevant module installationSome related modules need to be installed when using react:1, Babel NPM Install Babel-g--save-dev(where--save-dev indicates that the Babel module is placed under devdependencies of the current project's Package.json file, represent
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.