Giter Club home page Giter Club logo

learn-redux's Introduction

项目运行步骤:

> git clone https://github.com/yangbo5207/learn-redux.git
> cd learn-redux
> npm install
> npm start

运行完成后可以通过http://localhost:3000/访问项目

如果想要访问public目录中的demo,则直接在上面url后添加对应的html名即可,例如访问public/demo01.html,则使用 http://localhost:3000/demo01.html

如果想要访问src目录中的demo,则在src/index.js中单独引入对应的模块,并访问http://localhost:3000/即可。 例如要访问src/reduxDemo1中的demo,则修改src/index.js如下

import './reduxDemo1';

额外知识点:在create-react-app 创建的项目中添加sass/scss支持

  • 安装sass需要的loader
> npm install sass-loader node-sass --save-dev
  • 最初创建的项目中我们无法看到webpack相关的配置文件。因此我们需要执行下面的操作,让配置文件显示出来。
> npm run eject

如果你的项目中有未track的文件,会提示先删除这些文件,直接提交一次commit即可。

eject之后,会在项目中出现scriptsconfig2个文件夹。我们只需要修改config/webpack.config.dev.js即可。

  • module.exports.module.rules[1].exclude中添加如下子项
/\.scss$/,
/\.sass$/,
  • module.exports.module.rules中添加如下子项
{
  test: /\.s[ac]ss$/,
  include: paths.appSrc,
  loaders: ["style-loader", "css-loader", "sass-loader"]
},

修改完毕之后,保存文件,重启项目npm start即可。现在的项目已经支持.scss文件了。

参考资料 https://medium.com/@Connorelsea/using-sass-with-create-react-app-7125d6913760

learn-redux's People

Watchers

 avatar  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.