Skip to content

Allow for common interpolation patterns in the CLI #16

Description

@phillipluther

lerna has this neat feature for dynamically creating the commit message. They use placeholders in a string and replace them with the version number. For example:

lerna version -m "chore(release): publish %v"
# commit message = "chore(release): publish 1.0.0"

What if we did something similar to allow users to dynamically create the output file. This would enabled most users to use the feature directly from the command line. It would also negate the need for additional props like fileExt.

node-sass-extra src/**/*.scss -o dist/%n.min.css

dist/
    my-file.min.css
    my-other-file.min.css

We could possibly use Path's Path Object as the variables to replace.

So, in the case of:

/src/path/to/my-file.scss

These could be the options:

%d (dir) -> src/path/to
%r (root) -> /
%b (base) -> my-file.scss
%n (name) -> my-file
%e (ext) -> .scss

We could also just make up our own, I mean how useful would ext or base be when the file extensions is always going to be .css instead of .scss?

This feature would also enable the preservation of the file tree (since we may default the behavior to flattening the files)

node-sass-extra src/**/*.scss -o dist/%d/%b.css

Would this be passed via the output prop, or somewhere else/new API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions