Giter Club home page Giter Club logo

grunt-split-styles's People

Contributors

dbisso avatar tomteman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

grunt-split-styles's Issues

Options to include parent media query when matching a declaration

When matching a pattern such as /^\.rtl/ against:

@media screen and (min-width: 50em) {
    .rtl .thing {
        color: red;
    }

   .another .thing {
        color: blue;
    }
}

Currently yields:

.rtl .thing {
    color: red;
}

but we should have the option to include the parent media query node, giving us:

@media screen and (min-width: 50em) {
    .rtl .thing {
        color: red;
    }
}

See #2 (comment)

@extended selectors moved with split styles

@Extended selectors are being moved to the split stylesheet when they should be left behind.

In this example, I wish to move only .split-me to split-me.css:

// INPUT

// _demo.scss
%silent_shared {
    color: red;
}
.split-me {
    @extend %silent_shared;
}
.do-not-split-me {
    @extend %silent_shared;
}

// main.scss
@import "demo";

// OUTPUT - expected

// main.css
.do-not-split-me {
    color: red;
}

// split-me.css
.split-me {
    color: red;
}

// OUTPUT - actual

// main.css
// empty

// split-me.css
.split-me, .do-not-split-me {
    color: red;
}

Always set `from` and `to` options

Now you set from and to option only if source map is enabled. It is bad, because:

  • PostCSS parser uses from option to show syntax error messages.
  • PostCSS will try to autodetect previous map file with from options.

'pattern' and 'mediaPattern' returned as empty objects

My config:

split_styles: {
    rtl: {
        options: {
            pattern: /\.rtl/,
            output: '_styles/main.rtl.css'
        },
        files: {
            '_styles/main.css' : '_styles/main.css'
        }
    }
}

grunt --verbose outputs:

Files: _styles/main.css -> _styles/main.css
Options: separator="", pattern={}, remove, mediaPattern=false, unwrapMedia=false, output="_styles/main.rtl.css"

Looks like the pattern is not recognised.

Make 'output' optional

Allow the 'output' option to be 'false'

Use case would be to strip rules from the css, but not create a new file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.