bluewings / pug-as-jsx-loader

MIT License
188 stars 15 forks source link

Include CSS files directly from pug #12

Closed bluewings closed 6 years ago

bluewings commented 6 years ago

In some cases js does not need to know about css files.

Most css files are deeply involved with pugs, and js does not need to handle css.

//- sample.pug
// @import .scss => styles
.root(className='{styles.a}')
  h1.greeting hello world!
//- sample.pug.transpiled.jsx
import React from 'react';
import styles from './sample.scss';

export default function () {
  return (
    <div className={`root ${styles.a}`}>
      <h1 className="greeting">hello world!</h1>
    </div>
  );
}