Skip to content

New type "remove-block"? #50

@lyle-sigurdson

Description

@lyle-sigurdson

First off, thanks for useref.

I have a situation where I'd like to remove just the build block; that is, remove the link tag loading a CSS file, but allow the CSS file itself to be part of the final build.

What about a new type to add to the existing "js", "css" and "remove" types called "remove-block" that would carry this out?

The situation comes up when loading CSS that's not critical to rendering the above the fold content. The non-critical styles are loaded later by inserting a link tag on the document load event:

<!-- Defer loading 'css/styles.css' which contains styles that aren't       
     critical to rendering above the fold content.                          
-->                                                                         
<!-- build:remove-block -->                                                       
<link href="css/style.css" rel="stylesheet">                                
<!-- endbuild -->                                                           
<script inline src="js/defer-css.js"></script>

I'm using gulp-inline-source to inline the JavaScript.

If not, is this something I could set up myself with a custom block?

Edit: I should have mentioned that I want the link tag there in the first place (even though I'm going to remove it) so I can load the unprocessed files in a browser and have everything there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions