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

Prepend Sass code on build time #1533

Open
@davidballester

Description

@davidballester

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions