Comments (6)
@gangsthub Hi thanks for asking a question and so making the plugin better.
I have looked into it and you are totally right, this is not the expected behavior.
I'm going to dive into the code asap. For now I hope you came up with a temporary solution. I keep you posted.
Thanks
from gulp-sass-glob.
Sorry for the typos, and thanks to you, Mike
from gulp-sass-glob.
ignorePaths would be really helpful for a project I'm developing that requires different sets of css for different sites which all share the same library of sass. This doesn't work for me either so a big +1 from me on this. Again, great plugin other than this.
My pipe looks like this:
return gulp.src('./theme/sass/**/*.{scss,sass}')
// Initializes sourcemaps
.pipe($.sourcemaps.init())
.pipe($.sassGlob({
ignorePaths: [
'./theme/sass/**/brand-one.scss', // not working
'./theme/sass/**/brand-two.scss' // not working etc
]
}))
from gulp-sass-glob.
@webegguk @gangsthub Could you take a look at the code and see if you guys can help me with creating a PR for this feature?
Is it still relevant? Give me a bump so I can take a look at it ;)
from gulp-sass-glob.
@mikevercoelen I also come across with this problem and try to dig into the code, the issue is seems related to minimatch library you are using.
For example, if I am compiling the sass in a windows environment,
main.scss
// I want to include all scss files in the project but expect to ignore plugin's scss in the pipe
@import "../../folder/app/**/*.scss";
pipe
// Initializes sourcemaps
.pipe($.sourcemaps.init())
.pipe($.sassGlob({
ignorePaths: [
'**/plugins/**/*.scss'
]
}))
This will not work because in inside the path matching logic
files.forEach(function (filename) {
if (filename !== file.path && isSassOrScss(filename)) {
// remove parent base path
filename = _path2.default.normalize(filename).replace(basePath, '');
if (!ignorePaths.some(function (ignorePath) {
return (0, _minimatch2.default)(filename, ignorePath);
})) {
// remove parent base path
imports.push('@import "' + (0, _slash2.default)(filename) + '"' + (isSass ? '' : ';'));
}
}
});
console.log(filename); // C:\myWorkplace\projectFolder\web\folder\app\plugins\pluginA\style.scss
console.log(ignorePath); // **/plugins/**/*.scss
(0, _minimatch2.default)(filename, ignorePath); // false
But if I change the ignorePath to use back-slash in the pipe.
console.log(filename); // C:\myWorkplace\projectFolder\web\folder\app\plugins\pluginA\style.scss
console.log(ignorePath); // **\plugins\**\*.scss
(0, _minimatch2.default)(filename, ignorePath); // true
I suggest should try to get the path according to linux base style, regardless of what OS we are using.
Alternatively, let say I use Windows for development but Ubuntu for the build, a quick workaround is just append both slash & back slash style to the ignorePaths array.
return gulp.src('./theme/sass/**/*.{scss,sass}')
// Initializes sourcemaps
.pipe($.sourcemaps.init())
.pipe($.sassGlob({
ignorePaths: [
'**/plugins/**/*.scss',
'**\\plugins\\**\\*.scss'
]
}))
This seems a bit silly because I never have to handle these path formatting in any of my gulp task or gulp plugins, but before any new fixes apply, this is they solution.
Hope this will help anyone come across with similar issue
from gulp-sass-glob.
Great point, @paymok! Thank you.
This reminded me to a @sindresorhus' package called slash:
https://github.com/sindresorhus/slash
I would recommend using it or a simmilar one to get the system's slash style.
Also, the article cited it's pretty interesting:
http://superuser.com/a/176395/6877
According to it, as cited from slash readme:
Forward-slash paths can be used in Windows as long as they're not extended-length paths and don't contain any non-ascii characters.
Hope it adds also some light.
Kind regards, Mike
from gulp-sass-glob.
Related Issues (20)
- Consider going back to using releases on GH HOT 4
- Error after importing empty directory HOT 1
- Publish version 1.0.7 to npm
- Add support for `includePaths` HOT 2
- Control order of globbing partials? HOT 2
- Fails if a comment is on the same line as @import
- File to import not found or unreadable HOT 14
- Support for css files HOT 1
- Feature request for multiple single import with multiple lines HOT 2
- Variables don't work on imported Sass files HOT 1
- Exclude file? HOT 2
- Support globbing inside _partial file. HOT 4
- What order will the sass files be imported in? And is the order guaranteed? Please add to docs HOT 1
- parent path imports are not watching HOT 1
- Possible to glob for partial path name? HOT 1
- Globbing Time causes error HOT 6
- Nested Globbing - Working HOT 2
- Parent folders in Windows do not work HOT 2
- Support new sass modules HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-sass-glob.