Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging of transformed names #82

Closed
sholladay opened this issue Mar 5, 2018 · 0 comments
Closed

Improve logging of transformed names #82

sholladay opened this issue Mar 5, 2018 · 0 comments

Comments

@sholladay
Copy link

Since I upgraded this plugin to 1.x, building my app now logs hundreds of lines like these:

Exported "nav-left" as "navLeft" in lib/css/nav-bar.css
Exported "nav-search-wrapper" as "navSearchWrapper" in lib/css/nav-bar.css
Exported "nav-user" as "navUser" in lib/css/nav-bar.css
Exported "spinner-container" as "spinnerContainer" in lib/css/common.css
Exported "error-container" as "errorContainer" in lib/css/common.css
Exported "header-upload-container" as "headerUploadContainer" in lib/css/header.css
Exported "background-image" as "backgroundImage" in lib/css/header.css

... which is super useless.

The reason this happens is because I camelcase the exports using the namedExports option, to avoid the weird $__$ stuff that this plugin does by default. Here is my config:

postcss({
    modules : true,
    namedExports(name) {
        return camelcase(name);
    }
})

As discussed in #64 (comment), camelcasing should probably just be the default behavior. Presumably, at that point we would expect the plugin to only log if it encountered an export that would be a reserved word in JS.

In the meantime, while I'm waiting for a 2.x version to be released, I was thinking this plugin should skip these logs when namedExports is a function, as the user is fully controlling the name transformation, so shouldn't need to be told about it. I think it's okay to keep logging when it's true, as the default algorithm is unintuitive for now.

Alternatively, there could be an option to disable these logs, but that just increases the API surface unnecessarily IMO. And when 2.x comes, it would be even less necessary.

@egoist egoist closed this as completed in 3163614 Mar 5, 2018
bung87 pushed a commit to bung87/rollup-plugin-postcss that referenced this issue Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant