博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[React] {svg, css module, sass} support in Create React App 2.0
阅读量:5015 次
发布时间:2019-06-12

本文共 1882 字,大约阅读时间需要 6 分钟。

 added a lot of new features.

 

One of the new features is added the  webpack loader to wrap SVGs in React components as a named export. This let’s you either grab the filename from the default export or grab a wrapped SVG component depending on your needs.

 

Second of the new features is support for . If you start to use Sass, create-react-app will give you an error, but will give detailed instructions on how you can add Sass support to your project.

 

Thrid features is to add CSS Module support. CSS Modules automatically scope class names and animation names local by default to get around the problem of global name clashes. You can learn more by looking at the .

 

import React, {Component} from 'react';// ReactComponent support svgimport logo, {    ReactComponent as ReactLogo} from "./logo.svg";import './App.scss';// Supoortimport styles from './styles.module.css';class App extends Component {    render() {        return (            
logo

Edit src/App.js and save to reload.

Learn React
Learn React
); }}export default App;

 

App.scss:

.App-logo-svg {  height: 40vmin;  & g {    fill: salmon;  }  & path {    stroke: palegoldenrod;    fill: none;    stroke-width: 10px;    stroke-dasharray: 35px 15px;    animation: orbit 1s infinite linear;  }}@keyframes orbit { to { stroke-dashoffset: 50px; } }

 

styles.module.css:

.warning {
color: black; background-color: yellow;}.error {
color: white; background-color: red;}

 

转载于:https://www.cnblogs.com/Answer1215/p/9744049.html

你可能感兴趣的文章
HDU 5881 Tea -2016 ICPC 青岛赛区网络赛
查看>>
shell 编程之函数
查看>>
Microsoft Jet 数据库引擎 SQL 和 ANSI SQL 的比较
查看>>
int -2147483648 ----- 2147483647
查看>>
博客作业05--查找
查看>>
ios 涉及到支付金额计算的相关总结
查看>>
Python之UDP编程
查看>>
Autolayout
查看>>
PHP 错误与异常 笔记与总结(5)配置文件中与错误日志相关的选项 && 将错误记录到指定的文件中...
查看>>
PHP 中和 HTTP 相关的函数及使用
查看>>
makefile详解
查看>>
常见算法动画
查看>>
Python的简介以及安装和第一个程序以及用法
查看>>
子数组的和2
查看>>
Eclipse搭建springboot项目(四)热部署
查看>>
解决局域网IP冲突
查看>>
利用js自带函数验证邮箱,不用正则表达式
查看>>
aptana乱码解决办法(很原始的方法)
查看>>
正则匹配IP
查看>>
git源码中的Makefile
查看>>