react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Component CSS is Not loaded

Open VictorSage opened this issue 11 years ago • 30 comments

Installed version v0.9.1, I can use the component, but seems no CSS is loaded.

VictorSage avatar Nov 18 '15 17:11 VictorSage

+1

pranav avatar Nov 21 '15 01:11 pranav

I'm seeing this as well. Also in 1.0.0-beta.

milesegan avatar Nov 23 '15 03:11 milesegan

I ended up importing the css in my main.scss file to get it to work fyi

@import url('../../node_modules/react-select/dist/react-select.css');

pranav avatar Nov 23 '15 03:11 pranav

Thanks @pranav. That's a good workaround.

milesegan avatar Nov 23 '15 04:11 milesegan

I import default.scss in /node_modules/react-select/lib/Select.js

require('../scss/default.scss');

it works too

Heboy avatar Nov 23 '15 07:11 Heboy

for me it's still not working even after adding

require('../../node_modules/react-select/dist/react-select.css');

thirdknife avatar Nov 23 '15 16:11 thirdknife

this is my work around: create a package.json file and include the following:

{
  "style": "style.scss"
}

add the following line in style.scss

@import "react-select/scss/default";

VictorSage avatar Nov 23 '15 18:11 VictorSage

+1

vzaidman avatar Dec 10 '15 16:12 vzaidman

+1

brwinkle avatar Jan 07 '16 23:01 brwinkle

This still seems to be present in the newest beta. I'm using browserify and trying to require the CSS file, but the transforms that allow me to do so that I've tried (partialify and browserify-css) don't seem to play well with babelify. This seems to be a long-standing issue and I'm wondering if there's a fix on the way.

brwinkle avatar Jan 12 '16 16:01 brwinkle

+1

jonaskello avatar Jan 15 '16 07:01 jonaskello

+1

for the time being, i went super simple, and copied the dist/react-select.css file into my project, and it works great.

bradparks avatar Jan 31 '16 02:01 bradparks

import 'react-select/dist/react-select.css'; helped in my case (npm + webpack)

cema-sp avatar Feb 08 '16 13:02 cema-sp

I needed import 'css!react-select/dist/react-select.css as well as the webpack css module

rcoh avatar Feb 09 '16 19:02 rcoh

FYI, if you're using css-loader with ?modules enabled, you can override its default behavior like so:

:global {
  @import "~react-select/scss/select";
}

StevenLangbroek avatar Feb 15 '16 17:02 StevenLangbroek

Used @cema-sp's workaround, thank you! Wish there was a more elegant way to import the css though.

dianjin avatar Feb 28 '16 01:02 dianjin

@cema-sp Thanks a ton :+1: Took me a long time to finally stumble on this ticket. Your're suggestion is working for me on webpack

jxm262 avatar Mar 02 '16 01:03 jxm262

I tried to add import Select from 'css!react-select/dist/react-select.css'; in the main js and in the files where I used this component but doesn't style it

huvber avatar Mar 23 '16 13:03 huvber

+1

@huvber I directly linked the CSS via my index.html file

<link rel="stylesheet" type="text/css" href="node_modules/react-select/dist/react-select.css"> This seemed to fix the CSS issue. If you still get functionality issues check out #618

mrconnormurphy avatar Apr 07 '16 15:04 mrconnormurphy

@huvber you should not import anything from css, just css itself (remove Select from from your import expression).

cema-sp avatar Apr 08 '16 10:04 cema-sp