Table of Contents
1. Preface
2. The project file directory is displayed as follows
3. Project file analysis
3.1 build file
3.2 config file
3.3 node_moules file
3.4 src file
3.5 static files
3.5 test file
3.6 Other files
Home Web Front-end JS Tutorial Analysis of the directory structure after building the project with Vue-cli (picture and text)

Analysis of the directory structure after building the project with Vue-cli (picture and text)

Jul 27, 2018 am 11:39 AM

The content of this article is about the analysis of the directory structure after the Vue-cli project is built. It has a good reference value and I hope it can help friends in need.

1. Preface

Vue does not limit your code structure. However, it stipulates some rules that need to be followed:
1. Application-level status should be concentrated into a single store object.
2. Submitting a mutation is the only way to change the state, and this process is synchronous.
3. All asynchronous logic should be encapsulated into actions.

2. The project file directory is displayed as follows

3. Project file analysis

3.1 build file

build: The folder stores some configurations of webpack. Webpack is a project compilation, running, and packaging tool for front-end websites.
build.js: It is what we need to run after we complete the project. We can package our project files into static files and store them in the dist folder in the project root directory (there is no such file in the directory now) folder, which will be automatically generated when building).
check-versions.js: Mainly checks whether the versions of some dependent tools are applicable, such as nodejs and npm. If the version is too low, it will prompt.
logo.png: stores the vuelogo image.
utils.js: Provides tool functions, including generating loaders for processing various style languages ​​and tool functions for obtaining resource file storage paths.
vue-loader.conf.js: Introduced utils.js, which should be a file used to switch between development mode and production mode, so that loaders can be parsed in different modes.
webpack.base.conf.js: This configuration file is a wepack-related configuration file for the vue development environment. It is mainly used to handle the configuration of various files.
webpack.dev.conf.js: Based on webpack.base.conf, the configuration under the development environment is added and improved.
webpack.prod.conf.js: The webpack configuration used during construction comes from webpack.prod.conf.js, which is also further improved based on webpack.base.conf.

The file example is as follows:

3.2 config file

config: The file contains webpack environment configuration files.
index.js: Describes the configuration in both development and build environments.
dev.env.js, prod.env.js, test.env.js: These three files simply set environment variables.

An example file is as follows:

3.3 node_moules file

node_moules: The project dependency modules loaded by npm are stored here. Dependencies that need to be added in the future are also placed here.

The file example is as follows:

3.4 src file

src: Place components and entry files.
assets: A directory that mainly stores some static image resources.
components: Various components needed for development are stored here. Each component is connected together to form a complete project.
router: Stores the project routing file.
App.vue: It is the main component of the project and the outlet for all components and routes of the project. It will then be rendered and displayed in index.html in the root directory of the project. We can write some here Suitable for global css styles.
main.js: Entry file, which introduces the vue module, app.vue component and routing router. Some things we need to use globally can also be defined in it.

An example file looks like this:

3.5 static files

static: It stores the static files of the project. It is used to store some external js and css files that need to be used. When they need to be used, they are imported from here into the file.

The file example is as follows:

3.5 test file

test: Initial test directory.
unit: unit test, you can write unit tests for each component and place them under the test/unit/specs directory. It is recommended that the directory structure of the unit test case be consistent with the test file (relative to src ), each test case file name ends with .spec.js. When npm run unit is executed, all spec.js files will be traversed, and the test report will be output in the test/unit/coverage directory.
e2e: e2e or end-to-end or UI testing is a testing method. It is used to test whether the process of an application from beginning to end is as expected during design. Same.

An example file is as follows:

3.6 Other files

.babelrc : ES6 syntax compilation configuration.
.editorconfig: Code writing specifications.
.eslintignore: Create a file in the root directory of the project to tell ESLint to ignore specific files and directories. This file is a plain text file.
.eslintrc.js: eslint configuration file. eslint is a tool used to manage and detect js code style. It can be used with editors, such as vscode’s eslint plug-in. When there is code that does not match the content of the configuration file, an error or warning will be reported.
.gitignore: Ignored files.
.postcssrc.js: Compatibility option (if postcss has been installed, a lot of loader configuration is required, and the ".postcssrc.js" file will be generated in the project root directory).
index.html: Project file entry.
package.json: dependency configuration file for projects and tools.
README.md: Project description.

The file example is as follows:

Related recommendations:

Vue The initial construction process of the project (pictures and text)

The above is the detailed content of Analysis of the directory structure after building the project with Vue-cli (picture and text). For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What should I do if I encounter garbled code printing for front-end thermal paper receipts? What should I do if I encounter garbled code printing for front-end thermal paper receipts? Apr 04, 2025 pm 02:42 PM

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

Demystifying JavaScript: What It Does and Why It Matters Demystifying JavaScript: What It Does and Why It Matters Apr 09, 2025 am 12:07 AM

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

Who gets paid more Python or JavaScript? Who gets paid more Python or JavaScript? Apr 04, 2025 am 12:09 AM

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

How to merge array elements with the same ID into one object using JavaScript? How to merge array elements with the same ID into one object using JavaScript? Apr 04, 2025 pm 05:09 PM

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

Is JavaScript hard to learn? Is JavaScript hard to learn? Apr 03, 2025 am 12:20 AM

Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.

How to achieve parallax scrolling and element animation effects, like Shiseido's official website?
or:
How can we achieve the animation effect accompanied by page scrolling like Shiseido's official website? How to achieve parallax scrolling and element animation effects, like Shiseido's official website? or: How can we achieve the animation effect accompanied by page scrolling like Shiseido's official website? Apr 04, 2025 pm 05:36 PM

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

The difference in console.log output result: Why are the two calls different? The difference in console.log output result: Why are the two calls different? Apr 04, 2025 pm 05:12 PM

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...

How to implement panel drag and drop adjustment function similar to VSCode in front-end development? How to implement panel drag and drop adjustment function similar to VSCode in front-end development? Apr 04, 2025 pm 02:06 PM

Explore the implementation of panel drag and drop adjustment function similar to VSCode in the front-end. In front-end development, how to implement VSCode similar to VSCode...

See all articles