开发者社区> 镜像站> NPM> butterflyfx
butterflyfx
[ButterflyFX](http://www.butterflyfx.io) is a tool designed to test your CSS using data driven code instead of screenshots. You can find more info at http://www.butterflyfx.io
Last updated 3 years ago by akeem .
Proprietary · Original npm · Tarball · package.json
$ cnpm install butterflyfx 
SYNC missed versions from official npm registry.

Introduction

ButterflyFX is a tool designed to test your CSS using data driven code instead of screenshots. You can find more info at http://www.butterflyfx.io

You can install the javascript client by running

npm install butterflyfx-client

All examples require generating an API key from the website before making any requests.

Tunneling

ButterflyFX has the ability to connect to your localhost or any other internal resources through its tunneling feature.

However, this feature does not work through the browser and requires using node or a node based task runner such as gulp, grunt, karma, ember-cli, webpack, etc.

// npm install butterflyfx-client
const API_KEY = "INSERT-API-KEY-HERE";
const PROJECT_ID = 0; // Replace with specific project id or leave as zero for default
const ButterflyFX = require('butterflyfx-client');
let client = new ButterflyFX({project:PROJECT_ID, token:API_KEY});
// Only works when run from a node based task runner.
// e.g karma.conf.js, gulpfile.js, ember-cli-build.js, etc
client.tunnel("localhost:8000");

Adding a new fixture

You can create new fixtures from either the browser or node client. By default, the browser client captures the entire document, but you also specify any arbitary html document or html segment as a string.

const API_KEY = "INSERT-API-KEY-HERE";
const PROJECT_ID = 0;
const ButterflyFX = require('butterflyfx-client');
let client = new ButterflyFX({project:PROJECT_ID, token:API_KEY});
// An ordinary html string can be used here instead of document.querySelector 
let html = document.querySelector("html").outerHTML;
client.saveFixture({
  name: "Hello world",
  html: html
});

Current Tags

  • 0.0.5                                ...           latest (3 years ago)

3 Versions

  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (22)
Dependents (0)
None