Function analyze

  • Given a file path to a css file, this will run a postcss plugin over the file for analysis purposes. This is useful for pre-determining if a css file meets a condition, or has something that you may be looking for that could then provide more information to influence other decisions.

    See the plugin docs for postcss for more information.

    Parameters

    • filePath: string

      to the file to transform

    • plugin: Plugin

    Returns Promise<string>

    the transformed source

    Example

    import { css } from 'ember-apply';

    // ...

    let changedFontSize = false;

    await css.analyze('path/to/file.css', {
    Once(root) {
    root.walkRules(rule => {
    if (changedFontSize) return;

    rule.walkDecls(decl => {
    if (decl.prop === 'font-size') {
    changedFontSize = true;
    }
    });
    });
    }
    });

Generated using TypeDoc