Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Process CSS synchronously? Plus add example to DOC. #236

@nolimitdev

Description

@nolimitdev

1.) Is sync way available? I see in source code in index.cjs.js that it should return sync function when there is no import and export in options const canReturnSyncFunction = importFrom.length === 0 && exportTo.length === 0; but it seem to do nothing, always Promise/LazyResult is returned.

2.) Also it would be nice to add example here https://github.com/postcss/postcss-custom-properties/blob/master/INSTALL.md#node how to process CSS text and get it returned (not exported to file) because it took some time for me to understand how it works. There should be example(s):

var result = await PostcssCustomProperties.process('...YOUR_CSS_TO_PROCESS...', /* processOptions: */ { from: undefined },  /* pluginOptions: */ { preserve : false  });
console.log(result.css);
PostcssCustomProperties.process('...YOUR_CSS_TO_PROCESS...', /* processOptions: */ { from: undefined },  /* pluginOptions: */ { preserve : false  })
    .then((result) => {
        console.log(result.css);
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions