Inherit rules from other selectors
Inherit mixin for rework. Allows you to inherit all the rules associated with a given selector.
var inherit = require'rework-inherit'var css = reworkinputCSSuseinherittoString
propertyRegExp- Regular expression to match the "inherit" property. By default, it is
/^(inherit|extend)s?$/i, so it matches "inherit", "inherits", "extend", and "extends". For example, if you only want to allow the
extendkeyword, set the regular expression to
Inherit multiple selectors at the same time.
Any selector that includes a
% is considered a placeholder.
Placeholders will not be output in the final CSS.
If you inherit a selector, all rules that include that selector will be included as well.
Inheriting from inside a media query will create a copy of the declarations.
It will act like a "mixin".
%placeholders, you won't have to use mixins at all.
Each type of media query will need its own declaration,
so there will be some inevitable repetition.
Rework doesn't support nested syntax. However, you can simulate nested syntax with inheritance.
Thus, you have the features of nested syntax without the nesting.
- You can not inherit a rule that is inside a media query; you can only inherit rules outside a media query. If you find yourself in this situation, just use placeholders instead.
The MIT License (MIT)
Copyright (c) 2013 Jonathan Ong firstname.lastname@example.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.