Skip to content

keepImport #65

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

Closed
wants to merge 13 commits into from
Closed

keepImport #65

wants to merge 13 commits into from

Conversation

morulus
Copy link

@morulus morulus commented Nov 12, 2017

I worked with a situation when I need to precompile css-modules, but keeping the ability to use css-loader later.
With option keepImport we got the same result, but all import statements (or require expr.) stay kept.

// before
const styles = require('./test.css');
// after
require('./test.css');

const styles = {
    'someClass': 'Test__someClass___2Frqu'
}

But there are some difficulties with the tests - they do not work by default. Is this normal?

@michalkvasnicak
Copy link
Owner

@morulus could you rebase your PR on new master please?

@michalkvasnicak
Copy link
Owner

@morulus only one test case is failing. There is a problem with extensions option, somehow it doesn't pick up configured extensions, so it fails on .scss. Do the tests pass locally on your computer?

@morulus
Copy link
Author

morulus commented Nov 12, 2017

@michalkvasnicak No. A local test fails too. I did rebase. Local test still fails. And not only extensions. I got multiple fails. should accept file extensions as an array just one of them. There is two kind of failure:

First look like lost files

ENOENT: no such file or directory, open '/Users/morulus/Work/morulus/projects/babel-plugin-css-modules-transform/test/output/parent.css'

The second is strange

AssertionError: expected '/*  imported from css/child.css  */\n\n.child__line___3fweh {\n    display: inline;\n}\n\n/*  imported from parent.css  */\n\n.parent__block___33Sxl {\n    display: block;\n}\n\n/*  imported from styles.css  */\n\n.styles__className___385m0 {\n    color: red;\n}' to equal '.child__line___3fweh {\n    display: inline;\n}\n.parent__block___33Sxl {\n    display: block;\n}\n.styles__className___385m0 {\n    color: red;\n}'
      + expected - actual

      -/*  imported from css/child.css  */
      -
       .child__line___3fweh {
           display: inline;
       }
      -
      -/*  imported from parent.css  */
      -
       .parent__block___33Sxl {
           display: block;
       }
      -
      -/*  imported from styles.css  */
      -
       .styles__className___385m0 {
           color: red;
       }

As if it compares the text with special characters.

A total of 10 errors.

@michalkvasnicak
Copy link
Owner

@morulus I'm sorry, I'll take a look on this on Weekend.

@morulus
Copy link
Author

morulus commented Nov 24, 2017

@michalkvasnicak Thanks. I was busy a lot all week and will be busy the next, so you can take your time.

@michalkvasnicak
Copy link
Owner

@morulus released as 1.3.0, thank you very much 👍

@morulus
Copy link
Author

morulus commented Nov 26, 2017

@michalkvasnicak Good news! Thanks.

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

Successfully merging this pull request may close these issues.

3 participants