Run Task Runner tasks by build configuration in Visual Studio 2017

Visual Studio 2017 supports build tasks, accessible via the Task Runner Explorer. You can specify external build tasks that rely on npm, for example running Gulp and/or Grunt. These tasks can already be executed before or after the standard build task (Build > Build Solution | Rebuild Solution). For example in gruntfile.js, a directive can be added to the top of the file:

/// <binding BeforeBuild='TaskName' AfterBuild='DifferentTaskName' />

This is very handy and increasingly useful as more and more build tasks for web applications are integrated using these tools. A problem can arise where these additional build tasks begin taking considerable time on each build, and for files that rarely change. Visual Studio doesn’t yet support running these tasks only under certain build configurations, like the common Debug and Release. You may want to only combine and minify files when building for production (Release), or build CSS .maps during development (Debug).

In my case, all my tasks are built using Grunt via gruntfile.js. For production, I want to compile my CSS using LESS, with options to compress the results into one file and skip building a source map, as well as bundling and compressing various JavaScript files. In development however I just want to bundle the CSS along with a source map. This picks up CSS tweaks while leaving the JavaScript files unaffected.

To add this build configuration granularity to your project, you can use the old standby Build Events instead to run these tasks. To configure Visual Studio to execute Grunt by build configuration, make the following changes:

  1. In gruntfile.js, remove the <binding/> directive:
     /// <binding BeforeBuild='TaskName' AfterBuild='DifferentTaskName' />
  2. In gruntfile.js, register the tasks that need built under different configurations:
    grunt.registerTask('default', ['less:production', 'uglify']);
    grunt.registerTask('dev', ['less:development']);
    
  3. In Project Properties > Build Events, add calls to Grunt based on the build configuration:
    if $(ConfigurationName) == Debug (
    grunt dev
    )
    
    if $(ConfigurationName) == Release (
    grunt
    )

That’s it! Although simple when complete, piecing this together was a bit of a hassle so I wanted to write something up. If it saves one person time later, great! Comment and let me know so I know this wasn’t an even bigger waste of my time. 🙂 happy coding…

Advertisements

What a Privilege

This post-election feels different outside. Inside, the outcome was surprising, sobering, and disturbing, and subsequent days are only confirming many fears. Given the stark demographic contrasts in preferred candidates, there’s a sense that people are more suspicious of each other. As an older white male PoC are justifiably giving me side-eye. I’m trying to appear as disconcerted and troubled as possible (which has been easy to do, because I 9f1179b7924e90a88321d250f59d5015am), stalling for time to find a few t-shirts emblazoned with something that makes crystal clear that I didn’t support any of this. In the meantime, I’m stuck playing the suddenly popular game “Which of You Crackers Voted for Trump?” Nowadays with Facebook, it’s easy to find the proud deplorables amongst family and acquaintances. In the olden days, Know-Nothings would sneak around in the shadows but now they proudly display their ignorance to everyone.

One demographic group that stands out: White Evangelical Christians. Reportedly 81% voted for Donald Trump to be the President of the United States. A higher percentage voted for Trump than voted for (the decidedly more “Christian”) Mitt Romney or George W. Bush. These fine Christian volk didn’t have to vote for the villainous and despised Hillary Clinton; they could have refrained from sullyi07b57bc7dee49196fe66573fd3e39f2cng themselves in this election. Instead most actually voted for Donald Trump.

Many Evangelicals used to steer clear of messy politics, but have long been coopted by the Republican Party. Easily held in thrall by the single issue of abortion allows the expedited, short-circuited, easy-thinking these voters prefer. The issue easily fits into their narratives, allowing the dramatic staged event of decent folks with “values” versus unfeeling, atheistic baby killers. This simple litmus test has required them to defend disastrous Bush policies and compelled them to spend 8 years trashing the Obamas, who by all indications comported themselves as model Christians. These political Christians that are clearly commanded not to hate and slander then lustily spent the past 2 years trashing the Clintons (again), using everything from juvenile ad hominem insults to outright fabrications. I debated people who claimed in all seriousness that Hillary Clinton was possessed by a demon. Where do you go from there?

“To argue with a man who has renounced the use and authority of reason … is like administering medicine to the dead” – Thomas Paine

After all the grandstanding about morality and values since well before Bill Clinton, they disregarded all of that and voted for Trump. They didn’t just vote for him as last resort, but many opted for Trump in the primaries too. Donald J. Trump: exceedingly boastful yet still a fool. A man who has spent his life openly mocking and disregarding their faith, who was only recently pro-abortion (and likely paid for a few of them). He dodged military service, he’s an admitted sexual predator, ill-tempered, and unkind. Imagine Barack Obama running with any single one of these traits. Or if he’d had 5 kids from 3 wives. Trump lacks empathy and is hostile to marginalized groups, and he’s awash in racism and xenophobia. He demonstrably repeated more outright lies than any other candidate, maybe ever. There is no financial transparency and this is coupled with ties to our nation’s enemies. It’s like everything said about Richard Nixon and Bill Clinton was true and rolled into one person and clearly known in advance, and yet most Evangelical Christians still voted for him. They eagerly hopped into the same nasty basket as the KKK, internet trolls, selfish “libertarians”, misanthropic atheists, and outright anarchists, all with a prideful irreverence for our highest office.

Trump-ism is the very culmination of the Religious Right’s abandonment of its principles and convictions.  In the last presidential race, they were happy to shill for a prominent member of a Christian cult, a previously blasphemous splinter group with an ugly racist core. Most never accepted that Barack Obama is even Christian. This election cycle they finally rejected all their ostensible strictures and constraints and elected maybe the single worst specimen conceivable. In their entanglement with politics they have lost the moral high ground they claim to which they lay claim. Even in just my lifetime, American Christianity has morphed into the consumerist-friendly “Prosperity Gospel” and Evangelicals have charged ahead leading the parade. They either don’t understand or don’t care that they and their leaders have become the Pharisees from their holy book.

Evangelicals prefer Trump because he represents their kind of Christianity: nominal, authoritarian, and intolerant. Trump has aligned himself with superstitious charlatans and their dim foot-soldiers against secularism, intellectualism, and science. Trump and his running mat8fdcd9470067c126b66f5ce6a0bff181.jpge and their minions pay lip service to American Jesus to endorse an intrusive state that is anti-women, anti-choice, anti-speech, anti-gay, and more.

Evangelicals are comfortable in our new post-truth world because they are used to living in an alternate reality.  They can exist in an alternate universe their whole lives. They construct alt-Wikipedia. They reject the world’s great museums and construct their own pale, farcical imitations. They exist in the greatest privilege yet claim the greatest persecution. For so many reasons, Evangelicals are a great voting bloc. This is the same state-religion entanglement that our European ancestors traveled here to escape.

These hollow, politicized, husks of Christians likely won’t know shame no matter the outcome of this presidency they labored to bring to power. They will start by praying for Trump to have wisdom and end by praying for forgiveness. And they will justify any outcome, good or bad, as being part of the divine plan, for a God whose teachings they so readily sold for thirty pieces of worthless silver and restitution can never be made.

“What a friend we have in Jesus, all our sins and grieves to bear
What a privilege to carry everything to God in prayer.
Oh what peace we often forfeit, oh what needless pain we bear
All because we do not carry everything to God in prayer”

Hillary Clinton: Why she is the Only Real Anti-Abortion, Whole-Life Choice for Christians

As a life long pro-life Democrat, my interest has always been a genuinely whole-life platform. It has been clear to me, this year more than ever, that the Democratic platform is more …

Source: Hillary Clinton: Why she is the Only Real Anti-Abortion, Whole-Life Choice for Christians