epegzz/sass-vars-loader

Unable to pass version string to add inside css comment

Opened this issue · 2 comments

I am trying to pass the application version to the SCSS so that i can add it to the comments in the CSS file along with other useful info, but it gets translated from "4.2.0" into "4.2 0" is there a way to disable this auto transformation/parsing?

      {
        test: /\.(sass|scss)$/,
        use: [
          MiniCssExtractPlugin.loader,
          "css-loader",
          "sass-loader",
          {
            loader: "@epegzz/sass-vars-loader",
            options: {
              vars: {
                appVersion: `4.2.0`,
              },
            },
          },
        ],
      },

Having issues with passing "https://wordpress.org/" too, any was to disabled the parsing and validation:

SassError: Invalid CSS after "...uthorUrl: https": expected 1 selector or at-rule, was "://wordpress.org/;"
        on line 5 of assets/scss/style.scss
>> $themeAuthorUrl: https://wordpress.org/;

   -----------------^

    at processResult (/opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/webpack/lib/NormalModule.js:583:19)
    at runLoaders (/opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/webpack/lib/NormalModule.js:676:5)
    at /opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/loader-runner/lib/LoaderRunner.js:397:11
    at /opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/loader-runner/lib/LoaderRunner.js:252:18
    at context.callback (/opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at Object.render [as callback] (/opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/sass-loader/dist/index.js:62:7)
    at Object.done [as callback] (/opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/neo-async/async.js:8069:18)
    at options.error (/opt/app/increo/templates/wordpress/web/app/themes/increo-starter-theme/node_modules/node-sass/lib/index.js:293:32)

🤔 Hm, there's a good chance that throwing in some extra quotes will do the job:

vars: {
  appVersion: `"4.2.0"`,
},