scopify 0.2.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 67

scopify

scopify implements scoped styling in a manner similar to HTML5 and Vue. It processes the given HTML nodes and CSS stylesheets in-place, adding specialized attributes that make sure the CSS can only ever modify the given HTML.

Example

import 'package:csslib/parser.dart' as css;
import 'package:csslib/visitor.dart' show CssPrinter;
import 'package:html/parser.dart' as html;

import 'package:scopify/scopify.dart';


void main() {
  var myCss = 'p#my-id { color: purple; }';
  var myHtml = '<p id="my-id">purplified text here</p>';

  // First, we have to parse the CSS and HTMl text.
  var style = css.parse(myCss);
  var node = html.parse(myHtml);

  // Now, we can call scopify. It takes two arguments: a list of HTML nodes, and a list of CSS
  // stylesheets to process.
  scopify(html: [node], css: [style]);

  // The HTML and CSS parse trees were modified in-place. Now, the CSS will only ever modify this
  // HTML code, even when combined with other HTML code.

  // To get the resulting HTML:
  var resultHtml = node.outerHtml;
  print(resultHtml);

  // and CSS:
  var printer = new CssPrinter();
  style.visit(printer);
  var resultCss = printer.toString();
  print(resultCss);
}

development

0.2.0

Scoped styles have been changed now will not automatically "bleed" into other scoped styles. Bleeding can still be manually enabled, but it will still not bleed into other styles managed by scopify, e.g. it is more restrictive.

0.1.0

Initial version.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  scopify: "^0.2.1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:scopify/scopify.dart';
  
Version Uploaded Documentation Archive
0.2.1 Jul 3, 2018 Go to the documentation of scopify 0.2.1 Download scopify 0.2.1 archive
0.2.0 Dec 16, 2017 Go to the documentation of scopify 0.2.0 Download scopify 0.2.0 archive
0.1.0 Sep 26, 2017 Go to the documentation of scopify 0.1.0 Download scopify 0.1.0 archive

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
34 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
67
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:scopify/scopify.dart.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use scopify.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run dartfmt to format lib/scopify.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
csslib ^0.14.4 0.14.4
html ^0.13.3 0.13.3+1
meta ^1.1.5 1.1.5
source_span ^1.4.0 1.4.0
uuid ^1.0.0 1.0.1
Transitive dependencies
args 1.4.3
charcode 1.1.2
collection 1.14.10
convert 2.0.1
crypto 2.0.5
logging 0.11.3+1
path 1.6.1
typed_data 1.1.5
utf 0.9.0+4
Dev dependencies
test any