Skip to content

Commit

Permalink
escape $ in replace argument, fixed #58
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jan 11, 2018
1 parent 984dade commit 924513e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default (options = {}) => {

intro() {
if (!postcssLoaderOptions.inject || postcssLoaderOptions.extract) return
return styleInject.toString().replace('styleInject', '__$$styleInject')
return styleInject.toString().replace('styleInject', '__$$$$styleInject')
},

async transform(code, id) {
Expand Down
26 changes: 13 additions & 13 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ console.log(undefined, undefined);
exports[`inject:top: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -113,7 +113,7 @@ console.log(undefined, undefined);
exports[`minimize:inject: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -169,7 +169,7 @@ console.log(style.foo);
exports[`modules:inject: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -207,7 +207,7 @@ console.log(style.foo);
exports[`modules:named-exports: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -253,7 +253,7 @@ console.log(style$1);
exports[`postcss-config: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -288,7 +288,7 @@ __$$styleInject(css);
exports[`postcss-options: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -323,7 +323,7 @@ __$$styleInject(css);
exports[`sass: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -358,7 +358,7 @@ __$$styleInject(css);
exports[`sass:modules: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -396,7 +396,7 @@ console.log(style);
exports[`sass:sourcemap: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -431,7 +431,7 @@ __$$styleInject(css);
exports[`simple: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -471,7 +471,7 @@ console.log(css, css$1);
exports[`skip-loader: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -511,7 +511,7 @@ console.log(css, css$1);
exports[`sourcemap:inline: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down Expand Up @@ -551,7 +551,7 @@ console.log(css, css$1);
exports[`sourcemap:true: js code 1`] = `
"'use strict';
function __$styleInject(css, ref) {
function __$$styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
Expand Down

0 comments on commit 924513e

Please sign in to comment.