Front-end development process and correct posture written for back-end programmers.

Front-end development process and correct posture written for back-end programmers.

关键词: node .js,npm,webpack, laravel mix,package. json ,js代码压缩.

For a long time, back-end programmers may be unfamiliar with front-end, especially modern front-end engineering. When they see terms such as nodejs, npm, etc., they are confused. But back-end programmers are still in practice. More or less will touch the front-end. Maybe you need to modify other people’s front-end code, or develop your own front-end code (you may be a full-stack programmer).

Presumably you modify or write the front-end code, as I did before, directly find templates (including html, css.js) from the Internet and modify them into their own styles. Or write html.css.js from scratch.

No matter what type it is, you usually directly modify the css.js introduced in the Html page :).

You may also be a little confused, why does other people’s js code look like encrypted, I don’t know how to modify it?

And the css and js you write from scratch will be imported directly into the Html page.

There are some comments in the css and js code, as well as some spaces, blank lines, etc., which are directly quoted in the html page is actually the code that has not been compressed (remove spaces, blank lines, and comments). It will increase network transmission. amount, resulting in slower loading.

Moreover, the js you wrote is not compressed (removing spaces, comments, variables, renaming functions to short names, etc.), so others may steal your code.

If you compress js and then publish your code, and your js looks encrypted, others will basically not understand your code.

And all you have to do is separate the development code from the release code .

The directory structure of your project should look like this:

my-app/

———-index.html

———–src/

——————-app.css

——————-app.js

———–dist/

—————–app.js

—————–app.css

Where src is the source code directory or the development directory

dist is the release directory

index.html for your page,

pass…

The post Front-end development process and proper posture for back-end programmers. first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8641
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.