Skip to content

sitecues/sitecues-css-proxy

Repository files navigation

sitecues-css-proxy Build status for sitecues-css-proxy on Circle CI.

Serve cross-origin stylesheets.

Why?

  • Can serve any stylesheet from any website.
  • Responds with CORS enabled so JS can read the CSS rules.
  • Re-writes CSS (e.g. @import URLs) for continuity.

Install

npm install sitecues/sitecues-css-proxy --global

Usage

Command line

$ css-proxy --help

  Usage
    $ css-proxy

  Option
    --port           Listen on a specific HTTPS port for requests.
    --insecure-port  Listen on a specific HTTP port for requests.
    --target         Open a specific build in your browser.
    --open           Open the server root in your browser.

  Example
    $ css-proxy
    Build available at https://localhost/
    $ css-proxy --port=7000
    Build available at https://localhost:7000/

Programmatic

Get it into your program.

const CssProxy = require('sitecues-css-proxy');

Start the server.

const server = new CssProxy();
server.start().then(() => {
  console.log('Listening.');
});

API

CssProxy(option)

Returns a new server instance.

option

Type: object

Server configuration.

port

Type: number
Default: 443 if run as root, otherwise 3000

The HTTPS port that the server will listen on when .start() is called.

insecurePort

Type: number
Default: 80 if run as root, otherwise 3000

The HTTP port that the server will listen on when .start() is called.

tls

Type: object
Default: key/cert combo for localhost

The encryption settings used for HTTPS connections.

Contributing

See our contributing guidelines for more details.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

Copyright © Sitecues. All rights reserved.

About

Serve cross-origin stylesheets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published