Giter Site home page Giter Site logo

broccoli-app's Introduction

broccoli-app

起步

安装项目依赖

npm install

执行可用的 NPM SCRIPTS

npm start

启动一个用于开发环境的服务,在浏览器中打开 http://localhost:3003/

npm test

运行单元测试

npm run build

构建/打包代码为生产环境用的静态资源

自定义配置

查看 @hammal/cli-service 配置参考

功能调校

Babel

.babelrc:

{
  "presets": [
    "@hammal/babel-preset-app"
  ],
+ "plugins": [...]
}

ESLint

.eslintrc:

{
  "extends": "nicolaz-base",
  "parser": "babel-eslint",
+ "rules": { ... }
}

Browserslist

package.json:

{
  ...
  "browserslist": [
+   ...
  ]
}

CSS Reset

./src/assets/base.scss:

- @import "sanitize.css";
+ @import "normalize.css";

Native Fetch API

1、更换 @totebox/ajax@totebox/http:

npm uninstall @totebox/ajax
npm i @totebox/http

2、在 ./src/index.js 的最顶部:

+ import 'whatwg-fetch';

3、./src/api/index.js:

- import Ajax from '@totebox/ajax';
+ import Ajax from '@totebox/http';

4、根据 @totebox/http 文档调整全局请求配置

环境变量

你可以创建 .env.env.local.env.[environment],或 .env.[environment].local 文件来添加环境变量。参考文档: hammal-cli-service - 环境变量vue-cli 的环境变量和模式

./src 目录规范

./src
├── api
├── assets
├── components
├── utils
├── constants
├── configs
├── pages
└── index.js

api

后端接口请求模块

assets

全局资源:图片、样式等

components

通用组件

utils

通用工具函数等

constants

通用常量

configs

全局配置

pages

页面模块,或路由组件

index.js

入口文件,polyfill 和 全局样式等在此处导入

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.