GithubHelp home page GithubHelp logo

postcss-rs / astexplorer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fkling/astexplorer

0.0 0.0 0.0 13.52 MB

A web tool to explore the ASTs generated by various parsers.

Home Page: https://postcss-rs.github.io/astexplorer/

License: MIT License

CSS 7.18% HTML 9.93% JavaScript 80.20% Shell 2.28% EJS 0.42%

astexplorer's Introduction

CSS AST explorer

The ast explorer is not active since 2021/8/22, this fork just update postcss to the latest version for better debug experence

Paste or drop css code into the editor and inspect the generated AST on https://postcss-rs.github.io/astexplorer/

The AST explorer provides following css parsers:

  • [cssom][]
  • [csstree][]
  • [postcss][] + [postcss-safe-parser][] & [postcss-scss][]
  • [rework][]

Transforms

Since future syntax is supported, the AST explorer is a useful tool for developers who want to create AST transforms. In fact, following transformers are included so you can prototype your own plugins:

  • [postcss][]

How to add a new parser

  1. Go to website/.
  2. Install the new parser as dependency: yarn add theParser (or npm install -S theParser)
  3. Copy one of the existing examples in src/parsers/{language}.
  4. Adjust the code as necessary:
  • Update metadata.
  • Load the right parser (loadParser).
  • Call the right parsing method with the right/necessary options in parse.
  • Implement the nodeToRange method (this is for highlighting).
  • Implement the getNodeName method (this is for quick look through the tree).
  • Implement opensByDefault method for auto-expansion of specific properties.
  • Define _ignoredProperties set or implement forEachProperty generator method for filtering.
  • Provide a renderSettings method if applicable.

How to add a new transformer

  1. Go to website/.
  2. Install the new transformer as dependency.
  3. Copy one of the existing examples in src/parsers/{language}/transformers.
  4. Adjust the code as necessary:
  • Update metadata and defaultParserID.
  • Load the right transformer (loadTransformer).
  • Call the transformation method in transform.
  • Change sample transformation code in codeExample.txt.

Build your own version for development

  1. Clone the repository.
  2. Go to website/.
  3. Install all dependencies with yarn install (you can run npm install as well).

Run yarn run build for the final minimized version. Run yarn run watch for incremental builds.

Run yarn start to start a simple static webserver.

astexplorer's People

Contributors

fkling avatar rreverser avatar hzoo avatar gabelevi avatar danez avatar justjavac avatar turbo87 avatar irustm avatar skratchdot avatar timothygu avatar josephfrazier avatar jlhwung avatar aceslick911 avatar motiz88 avatar gengjiawen avatar mroch avatar rwjblue avatar jeffmo avatar smelukov avatar gabro avatar btmills avatar christianmurphy avatar gyandeeps avatar ikatyang avatar jridgewell avatar mohsen1 avatar rundevelopment avatar vtrushin avatar nmalaguti avatar wooorm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.