Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Prepend Sass code on build time #1533

Open
davidballester opened this issue Jul 1, 2019 · 0 comments
Open

Prepend Sass code on build time #1533

davidballester opened this issue Jul 1, 2019 · 0 comments

Comments

@davidballester
Copy link

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

I cannot prepend Sass code on build time. I either replace everything using the file option or lose the data option, as seen in sass.ts#L137.

What behavior are you expecting?

I expect the data option to behave as with sass-loader, prepending its content to the actual source Sass code.

Steps to reproduce:

  1. Create a sass.config.js locally and configure it in package.json, ionic_sass.
  2. Export a data option with static content, such as data: "$primaryBase: #ffffff",
  3. Use that variable in variables.scss.
  4. It will fail on build time, not finding $primaryBase, as it is ignored.
# sass.config.js
const sassConfig = require('@ionic/app-scripts/config/sass.config.js');
const path = require('path');
require('dotenv-defaults').config({
    path: path.join(__dirname, '../.env'),
    defaults: path.join(__dirname, '../.env.defaults'),
    encoding: 'utf-8',
});

module.exports = {
    ...sassConfig,
    data: `$primaryBase: ${process.env.PRIMARY_BASE};`,
};

# variables.scss
$colors: (
    primary: (
        base: $primaryBase,
    )
);

Which @ionic/app-scripts version are you using?
3.2.3

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant