colourgarden / avalanche

Superclean, powerful, responsive, Sass-based, BEM-syntax CSS grid system
http://colourgarden.github.io/avalanche/
MIT License
625 stars 40 forks source link

Import avalanche to a react typescript project #46

Open LucaHermann opened 3 years ago

LucaHermann commented 3 years ago

Hi i try to add avalanche to my typescript react project i have install it with npm install --save avalanche-css but when i try to use it inside my components like :

<div className="grid grid--center">
  <div className="2/2 grid__cell--center">

My jsx don't apply the style to the code like it was usually do it when i was using it with Shopify i don't get why.

Should i have to import something like import {grid} from 'avalanche' or <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/avalanche-css/1.3.0/avalanche.min.css"/>

Ihave eject the project and im using :

    "@babel/core": "^7.12.3",
    "@pmmmwh/react-refresh-webpack-plugin": "0.4.2",
    "@svgr/webpack": "5.4.0",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react-dom": "^16.9.8",
    "@typescript-eslint/eslint-plugin": "^4.5.0",
    "@typescript-eslint/parser": "^4.5.0",
    "avalanche-css": "^1.3.1",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.6.0",
    "babel-loader": "8.1.0",
    "babel-plugin-named-asset-import": "^0.3.7",
    "babel-preset-react-app": "^10.0.0",
    "bfj": "^7.0.2",
    "camelcase": "^6.1.0",
    "case-sensitive-paths-webpack-plugin": "2.3.0",
    "css-loader": "4.3.0",
    "dotenv": "8.2.0",
    "dotenv-expand": "5.1.0",
    "eslint": "^7.11.0",
    "eslint-config-react-app": "^6.0.0",
    "eslint-plugin-flowtype": "^5.2.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jest": "^24.1.0",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-testing-library": "^3.9.2",
    "eslint-webpack-plugin": "^2.1.0",
    "file-loader": "6.1.1",
    "fs-extra": "^9.0.1",
    "html-webpack-plugin": "4.5.0",
    "identity-obj-proxy": "3.0.0",
    "jest": "26.6.0",
    "jest-circus": "26.6.0",
    "jest-resolve": "26.6.0",
    "jest-watch-typeahead": "0.6.1",
    "mini-css-extract-plugin": "0.11.3",
    "optimize-css-assets-webpack-plugin": "5.0.4",
    "pnp-webpack-plugin": "1.6.4",
    "postcss-flexbugs-fixes": "4.2.1",
    "postcss-loader": "3.0.0",
    "postcss-normalize": "8.0.1",
    "postcss-preset-env": "6.7.0",
    "postcss-safe-parser": "5.0.2",
    "react": "^17.0.1",
    "react-app-polyfill": "^2.0.0",
    "react-dev-utils": "^11.0.0",
    "react-dom": "^17.0.1",
    "react-refresh": "^0.8.3",
    "resolve": "^1.18.1",
    "resolve-url-loader": "^3.1.2",
    "sass-loader": "8.0.2",
    "semantic-ui-css": "^2.4.1",
    "semantic-ui-react": "^2.0.1",
    "semver": "^7.3.2",
    "style-loader": "1.3.0",
    "terser-webpack-plugin": "4.2.3",
    "ts-pnp": "1.2.0",
    "typescript": "^4.0.3",
    "url-loader": "4.1.1",
    "web-vitals": "^0.2.4",
    "webpack": "4.44.2",
    "webpack-dev-server": "3.11.0",
    "webpack-manifest-plugin": "2.2.0",
    "workbox-webpack-plugin": "5.1.4"

Sorry for the dumb question but i try to use it for a technic test but i find nothing for help me on the web for how implement it properly inside my project.

colourgarden commented 3 years ago

I think the following should work when using webpack sass-loader:

import '~/avalanche-css/_avalanche.scss'

The tilde is a webpack 4.0 feature which refers to the node_modules directory in your project.