Skip to content

process() doesn't work if src parameter only contains HTML #19

@Stephen-X

Description

@Stephen-X

It's part of a series of issues I found, so I'm going to reuse the base test case and open separate issues for each of them 😄 I'm developing on Windows btw; not sure if these are all platform specific bugs.

Issue Description:

If you only send HTML file to the process function, then it'll only output a new CSS file.

Steps to reproduce this issue:

  1. Create a simple project with the following code:

index.html:

<html>
    <head>
        <meta name="description" content="Fire in the hole!">
        <link rel="stylesheet" href="style.css">
    </head>
    <body div class="in wf-active">
        <p>Fire in the hole!</p>
    </body>
</html>

style.css:

.wf-active {
    color: red;
}

.in {
    font-weight: bold;
}

selector_obfs.js:

const rcs = require('rename-css-selectors')

rcs.loadMapping('./temp/renaming_map.json')

rcs.processCss('style.css', {newPath: 'temp'}, err => {
    rcs.process(['index.html'], {newPath: 'temp'}, err => {
        rcs.generateMapping('./temp', { overwrite: true }, err => {
            // the mapping file is now saved
        })
    })
})
  1. Run RCS by node selector_obfs.js. Notice that there's no new HTML files in the temp directory; only the CSS file gets renamed.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions