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

Ionic v3 sass.config.js ignore excludeFiles regex #1541

Open
ghost opened this issue Dec 9, 2019 · 1 comment
Open

Ionic v3 sass.config.js ignore excludeFiles regex #1541

ghost opened this issue Dec 9, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 9, 2019

Short description of the problem:

I have added sass.config.js file and properly configured on package.json.
I set this to accept every scss/css on includeFiles and exclude other scss through regex but it doesn't work because i see every styles on main.css builded.
This is my sass.config.js:

`module.exports = {

outputFilename: process.env.IONIC_OUTPUT_CSS_FILE_NAME,

sourceMap: false,

outputStyle: 'expanded',

autoprefixer: {
browsers: [
'last 2 versions',
'iOS >= 8',
'Android >= 4.4',
'Explorer >= 11',
'ExplorerMobile >= 11'
],
cascade: false
},

includePaths: [
'node_modules/ionic-angular/themes',
'node_modules/ionicons/dist/scss',
'node_modules/ionic-angular/fonts'
],

includeFiles: [
/.(s(c|a)ss)$/i
],

excludeFiles: [
/^(.*_(?=name).*\.scss$)/igm
//i want to exclude every xyz_name.scss (tested on regex101.com)
],

variableSassFiles: [
'{{SRC}}/theme/variables.scss'
],

directoryMaps: {
'{{TMP}}': '{{SRC}}'
},

excludeModules: [
'@angular',
'commonjs-proxy',
'core-js',
'ionic-native',
'rxjs',
'zone.js'
]

};`

What behavior are you expecting?

I expect that build every .scss except "_name.scss"

Steps to reproduce:

  1. use my sass.config.js
  2. create some *_name.scss
  3. ionic-app-scripts serve
  4. you see all the scss

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

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

@ghost
Copy link
Author

ghost commented Dec 9, 2019

I have added some logs on sass.js inside app-scripts folder, and i see that finds correctly files to exclude.

[app-scripts] /^(.*_(?=name).*\.scss$)/gim contactList_name.scss
[app-scripts] MATCH TRUE

but on final build i find all the stylesheets.

Update: After several hours I found the problem! It seems that not accept regex with /igm parameter.
If I insert the following regex:
/^(.*_(?=name).*\.scss$)/i
it works like a charme.

Is it a bug?

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

0 participants