question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support JSS extend plugin by default

See original GitHub issue

Expected Behavior

  • Text color: #FF0000
.App-text-273 {
    color: #FF0000; // <--- Expected
    cursor: pointer;
    font-size: 50px;
    user-select: none;
}

Current Behavior

.App-text-273 {
    extend: ext; // <--- Invalid
    cursor: pointer;
    font-size: 50px;
    user-select: none;
}

Steps to Reproduce (for bugs)

import React, { Component } from 'react'
import ReactDOM, { render } from 'react-dom'
import PropTypes from 'prop-types'
import { withStyles } from 'material-ui/styles'

const styles = theme => ({
  ext: {
    color: '#FF0000',
  },
  text: {
    extend: 'ext',
    fontSize: '50px',
    cursor: 'pointer',
    userSelect: 'none'
  }
})

@withStyles(styles)
class App extends Component {
  static propTypes = {
    classes: PropTypes.object.isRequired
  }

  onClick(event) {
    const className = event.target.getAttribute('class')
    const style = getComputedStyle(event.target, null)
    const { fontSize, cursor, userSelect, color } = style

    console.log(`className: ${className}`)
    console.log({ fontSize, cursor, userSelect, color })
  }

  render() {
    const { classes } = this.props
    return (
      <p className={classes.text} onClick={this.onClick}>Foo Bar Baz</p>
    )
  }
}

render(<App />, document.getElementById('root'))

Edit 88ywmypq7l

Environment

Tech Version
Material-UI 1.0.0-beta.22
React 16.0.0
browser Chrome Version 62.0.3202.94 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:27
  • Comments:60 (27 by maintainers)

github_iconTop GitHub Comments

19reactions
oliviertassinaricommented, Nov 30, 2017

@tdkn Thanks for the feedback. I’m adding the change into the breaking change part of the changelog.

15reactions
dreamingblackcatcommented, Jun 27, 2018

👍 on re-adding back those two (extend and compose). They’re definitely worth it for a mere 2KB IMO.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support JSS extend plugin by default #9342 - mui/material-ui
@vdimitroff Material-UI allows providing custom JSS plugins. The issue was about changing the default ones. 1
Read more >
jss-plugin-default-unit
Default units for numeric values. Provide numeric values in your style definitions, and the plugin will insert the corresponding units.
Read more >
jss-plugin-extend | Yarn - Package Manager
[jss] Keyframe IDs are now scoped by default. [jss] Function values, function rules and observables apply plugins by default now, which means they...
Read more >
Advanced styling in material-ui - Stack Overflow
jss -plugin-extend is not included by default in Material-UI. You can find the list of included JSS plugins here: ...
Read more >
jss-plugin-extend - npm
JSS plugin that enables mixing in styles.. Latest version: 10.9.2, last published: 5 months ago. Start using jss-plugin-extend in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found