Comments (5)
This is indeed something I required as well. My usecase is to skipping debug info for the production version, while I would include the debug info in my debug version.
I made small modifications to the bake.js file to make this available:
Modification 1:
function inlineReplace( attributes, content, filePath, values ) {
var inlineValues = parseInlineValues( attributes );
if ( doSkip(inlineValues)) return ""; // <-- Added this line
if ( validateIf( inlineValues, values ) ) return "";
modification 2: added the doSkip function underneath the validateIf function:
// Handle _skip attributes in inline arguments
function doSkip(inlineValues) {
if ("_skip" in inlineValues) {
var skipValue = inlineValues["_skip"];
var taskOptions = grunt.task.current.data.options;
if (skipValue in taskOptions) {
var doSkip = taskOptions[skipValue];
console.log("Skip value "+skipValue+" result is: "+doSkip);
return doSkip;
}
else
console.log("Skip value "+skipValue+" not found on task Options.");
}
console.log("Leave validateSkip with false");
return false;
}
This enables the following syntax:
<!--(bake-start _skip="exludeDebug")-->
.. anything you like here ...
<!--(bake-end)-->
in the gruntfile:
bake:{
yourTarget:{
options: {
excludeDebug: (configuration != "debug"),
},
files: ...
}
Using a flag in the options section of the bake target, you can control whether content will be skipped or not.
Feel free to use it, feedback on it, modify it or get inspired by it.
from grunt-bake.
Pretty much what @PaulHuizer describes here was implemented by us as the _render
attribute. See here: https://github.com/MathiasPaumgarten/grunt-bake/#inline-_render-statement
Does that solve your problem/feature-request?
from grunt-bake.
Hi,
i'm afraid it's not.
The idea is that bake knows when an html file is baked as an html file or is included in an another html file in the same task run. My idea is to have access to this internal knowledge to decide if a html portion has to be removed or not.
Perhaps i'm wrong but relying on a user task's setting doesn't provide this.
By the way, here's what we've done with your great tool. Thanks a lot because we couldn't have done this in 4 month without bake :).
from grunt-bake.
for me it works fine!!!
from grunt-bake.
As I am reviewing some older issues. This has been open for a long time and not approved upon. I think I will close this feature task until it comes up again. I haven't heard of another person needing it.
Thanks everyone! If anyone is still in need for this, I am more than willing to revisit this.
from grunt-bake.
Related Issues (20)
- Version for gulp HOT 1
- When in '_section', use properties outside this '_section' HOT 11
- Evaluate content inside of _section HOT 1
- Add variable for linking to originating file when using _bake-attribute HOT 2
- Integration of default transforms HOT 1
- Pass arrays/objects as inline attributes HOT 9
- Can't access properties in _section HOT 1
- bake-escape feature request HOT 20
- JSON file or CSV convert to multiple HTML files HOT 9
- Simple bake test HOT 1
- foreach loop to build multiple files per object HOT 1
- Unset variables are rendered as "undefined" HOT 3
- Placeholder Default HOT 5
- Assign/use variable in same file HOT 1
- Builtin placeholders HOT 2
- How to convert a folder with bake ? HOT 2
- Generate Bake with grunt.config.get HOT 2
- Bake one HTML file / JSON section in one go HOT 5
- Iteration over objects in _foreach HOT 6
- Can I read from package.json? HOT 2
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 grunt-bake.