skip to Main Content

when I try to import styles.css from App.js like this

import React from 'react';
import {render} from 'react-dom';
import * as PropTypes from 'prop-types';
import {AppProvider, Page, Card, Button} from '@shopify/polaris';
import '@shopify/polaris/styles.css'; // << issue

import SettingsForm from './SettingsForm';

class App extends React.Component { 
static contextTypes = {
  easdk: PropTypes.object,
};

render() { 
  return (
    <AppProvider>
      <Page title="Settings">
        <SettingsForm />
      </Page>
    </AppProvider>
  );
}
}

export default App;

I get an error: Failed to compile

./node_modules/@shopify/polaris/styles.css (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./node_modules/@shopify/polaris/styles.css)
Unclosed bracket (3864:37)

  3862 |     background-color:#c4cdd5;
  3863 |     background-color:var(--progress-upper, #c4cdd5);
> 3864 |     background-image:linear-gradient(to right, transparent 0%, transparent 0%, transparent 100%, transparent 100% transparent;
       |                                     ^
  3865 |     background-image:linear-gradient(to right, var(--progress-lower, transparent) 0%, var(--progress-lower, transparent) var(--Polaris-RangeSlider-progress, 0%), var(--progress-upper, transparent) var(--Polaris-RangeSlider-progress, 100%), var(--progress-upper, transparent) 100%);
  3866 |     border:none;

I verified the css inside node_modules/@shopify/polaris/styles.css is the same as https://sdks.shopifycdn.com/polaris/2.12.1/polaris.css

I did a global search for this line background-image:linear-gradient(to right, transparent 0%, transparent 0%, transparent 100%, transparent 100% transparent; but result came out to 0

Why am I getting an error here and how can I overcome this please?
thank you.

2

Answers


  1. Don’t import css in node_modules in App.js,if you want to overwrite some settings in node_modules,you should create a css or less file,and import the css in css or less file.And,there are many css property in @shopify/polaris/styles.css,ther is no need to import them all.

    Login or Signup to reply.
  2. This was a known issue

    https://github.com/Shopify/polaris/issues/441

    Upgrade to the latest / next version (3.0.0-RC3) and it should be fine.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search