0.0.98 • Published 5 years ago

@erect/css-loader v0.0.98

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
5 years ago

Erect Logo Erect Animation

CSS Loader for Erect

It loads your CSS isomorphically between server and client using Erect DocumentState manager

Key aspacts

Typings

/* Header.css */
.header {
  background-color: green;
}

.header h4 {
  font-weight: bold;
}

.header .side-nav {
  font-weight: bold;
}
// Header.d.ts
import { RenderRequest } from '@erect/core';

export const loadStyles: (req: RenderRequest) => void;

export interface IHeaderCss {
  header: string;
  'side-nav': string;
  sideNav: string;
}

export const getStyles: (req: RenderRequest) => IHeaderCss;

Usage

import '@erect/static';
import { mount } from '@erect/core';
import headerCss from './header.css';

mount()
  .render((req) => {
    const styles = headerCss.getStyles(req);
    return req.renderStatic(req.html `
      <header class="${styles.header}">
        <nav class=${styles.navBar}>
          <ul>
            <li>item</li>
          </ul>
        </nav>
      </header>
    `);
  });  

Options

typings boolean

It's true by default, it generates typings and emit generated css files, make sure to use this only when targeting client

file object

Pass File Loader options

css object

Pass CSS Loader options

use array

Pass an array of loaders to process module after CSS Loader and before File Loader

silent boolean

No log output

typingsBanner string

Append a banner message to generated typings

0.0.98

5 years ago

0.0.97

5 years ago

0.0.96

5 years ago

0.0.95

5 years ago

0.0.94

5 years ago

0.0.93

5 years ago

0.0.92

5 years ago

0.0.91

5 years ago

0.0.90

5 years ago

0.0.89

5 years ago

0.0.88

5 years ago

0.0.87

5 years ago

0.0.86

5 years ago

0.0.85

5 years ago

0.0.84

6 years ago

0.0.83

6 years ago

0.0.82

6 years ago

0.0.81

6 years ago

0.0.80

6 years ago

0.0.79

6 years ago

0.0.78

6 years ago

0.0.77

6 years ago

0.0.76

6 years ago

0.0.75

6 years ago

0.0.74

6 years ago

0.0.73

6 years ago

0.0.72

6 years ago

0.0.71

6 years ago

0.0.70

6 years ago

0.0.69

6 years ago

0.0.68

6 years ago

0.0.67

6 years ago

0.0.66

6 years ago

0.0.65

6 years ago

0.0.64

6 years ago

0.0.63

6 years ago

0.0.62

6 years ago

0.0.61

6 years ago

0.0.60

6 years ago

0.0.59

6 years ago