bluewings / pug-as-jsx-loader

MIT License
188 stars 15 forks source link

Thanks for you work #45

Closed jt3k closed 4 years ago

jt3k commented 4 years ago

I have two questions.

  1. can i use mixins like bemto
  2. can i use inline styles in a style tag? image i also tryied this variants
    style
    .lolo { background: red; }
    style
    ='.lolo { background: red; }'
    style
    !='.lolo { background: red; }'
    style
    |'.lolo { background: red; }'
bluewings commented 4 years ago

@jt3k How about using the @import CSS annotation?

If the pug file name is Sample.pug, the code below will automatically import Sample.scss. (Definitions for css or scss loaders should be added to webpack.)

Sample.pug

// @import .scss => styles
div(className='{styles.lolo}')
  div(className='{styles.lala}')
    h1 {message}

Sample.scss

.lolo {
  background: red;
  .lala {
    color: blue;
  }
}
import React from 'react';
import styles from './Sample.scss';

export default function (props = {}) {
  const { greetings } = props;
  return (
    <div className={styles.lolo}>
      <div className={styles.lala}>
        <h1>{message}</h1>
      </div>
    </div>
  );
}
jt3k commented 4 years ago

👍