Comments (4)
That's how Sass works—@extend
works globally across all selectors that will be part of your output file.
The good practice is usually to extend a placeholder selector that is only used in the given file. E.g.:
%input, input {
// ...
}
select {
@extend %input;
}
Maybe use classes instead of tag names, if you don't intend to apply the styling to all elements with the same name your application.
That said, Stack Overflow is a more suited place to ask technical questions.
from gulp-ruby-sass.
@UltCombo thank for your answer, because I just have 2 inputs and 2 selects there so I don't want to think about naming, that's why I used only tag names (I'll change now)
You are right that I should ask inside StackOverflow than here, it is just because I was typing the issue and just found that @extend
in the same time so I asked here.
in my scss file, I let select
extend only the input
but later it extended also input[type="checkbox"]
, is it correct with sass?
from gulp-ruby-sass.
Yep, the @extend
behavior is working as designed, but I agree it is rather non-intuitive quite often. The behavior is documented as follows:
@extend
works by inserting the extending selector […] anywhere in the stylesheet that the extended selector […] appears.
So @extend
works on partial and even nested selectors.
See also: What Nobody Told You About Sass’s @extend
from gulp-ruby-sass.
Many thanks, it is clear now!
from gulp-ruby-sass.
Related Issues (20)
- cannot load compass HOT 2
- Wrong path when compiling HOT 2
- stream.js:74 throw er; // Unhandled stream error in pipe. HOT 1
- This repository workin with .sass extension ? HOT 1
- "Command line too long" on Windows when compiling a lot of files.
- Error: must provide pattern HOT 3
- Compilation failure emit can't emit HOT 1
- I am working on windows , gulp command gives so many errors, got tired , not even started to work on responsive web, solving installation errors since 10-15 days
- Sass does not support tempDir option HOT 2
- 'Gem sass not installed' HOT 2
- No Output File HOT 2
- globbing doesn't seem to allow file exclusion HOT 1
- @import does not work HOT 1
- SASS compilation breaks on valid media query HOT 1
- Outputs to incorrect directory HOT 1
- Replace deprecated dependency gulp-util
- Disabling the `debugInfo` and `quiet` in the config is throwing an error. HOT 1
- `cacheLocation` vs `tempDir` HOT 1
- OptionParser::InvalidOption: invalid option: -atch 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-ruby-sass.