-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to completely omit blocks with unmatched build targets? #111
Comments
As the documentation says: "Specifying true will strip comments which do not match the current target" In my case this means that the destination file still contains all unprocessed script elements but without comments. Removing the comments is fine but how to remove the block content when the build target is unmatched? |
Could you provide a short example of the input -> output you seek? |
Ok, I got it! |
To complete with an example:
This special comment combines "remove:dist" with "js:dev inline". Running "grunt dev" will replace the script element with the corresponding inline javascript. And running "grunt dist" will write nothing to the destination file. Im am not sure why this syntax actually works because the documentation only says that you canpass multiple comma-separated targets and but not multiple types. In my example I passed multiple build types with a single target for each type. Is my syntax valid in your eyes? Update: "grunt dev" does not inline the javascript so the example does not work as intended. |
hm i see thanks for the feedback. we'll see if this comes up again to make it a feature. not many grunt users anymore though. however this maybe more useful to include directly in the core parser https://github.com/dciccale/node-htmlprocessor will keep it in mind |
Your example seems incomplete |
I am having problems escaping comments in markdown code. Now it looks fine :-) |
Update: The example does not work as expected for "grunt dev" because the script does not get inlined. So the syntax given in the example is wrong. Is it even possible to pass multiple types in the comment ("remove" and "js")? |
Currently every block gets written to the destination file even when the build target does not match the block target. But this results in too many blocks within the destination file (each for every target).
Is there a way to completely exclude/omit blocks based on the build target? Or is it possible to combine or nest "build:remove:dev" with "build:js:dist inline" somehow to achive the desired effect?
The text was updated successfully, but these errors were encountered: