Imagine bringing sodas or chocolate bars to work, only to have a fellow employee toss your junk food in the trash after spotting it in the kitchen.

That's what was happening at a venture-backed start-up called Health IQ, and it was a policy that its workers wanted, according to CEO Munjal Shah. Health IQ's careers page promoted an office with no sugar, candy bars or soda and said, "If you bring some it will get thrown away."

But now the company is lightening up a bit, and this week toned down the rhetoric on its website. The change of heart came after a developer named David Heinemeier Hansson, who is the creator of Ruby on Rails, tweeted to his 280,000 followers over the weekend that he couldn't work at Health IQ due to his candy bar habit.

"I did work out this morning," he tweeted. "But I'm also going to eat a f---ing Twix today. I know, I know, not HealthIQ employee material."

Commenters to the tweet responded by describing the culture as "cultish" and "fit supremacist."

Health IQ, which sells life insurance to what it describes as "health conscious people," was started by Shah after a health scare he experienced while at Google. The company wanted to create a culture with deeply ingrained health habits, including promoting regular use of the gym, which it said was "right in the middle of the office."

Shah admits that Health IQ might have taken it too far, and acknowledged that the company did a poor job in communicating itself to the outside world. Health IQ's "Join the Movement" page now says the following:

"We've received some feedback recently on our Careers page and how we describe our culture and workplace, and we realize we may have missed the mark."

But Health IQ is far from alone among technology companies in pushing healthy behaviors to its employees.

Wellness is a growing trend in Silicon Valley and beyond, with many employers dangling financial rewards in exchange for employee participation in so-called "biometric screenings" or Fitbit challenges that encourage internal competition.

Workplace wellness: A way to save costs

Some employers are going even further and designing their offices with walking paths and additional stairs, said Jennifer Benz, founder of Benz Communications, a San Francisco-based firm that advises companies like Nvidia and Adobe on their benefits strategy. That's in addition to subsidized gym memberships and organic, healthy food options.

For many employers, it's worth the investment.

Health and wellness perks help with recruitment and retention, and there's some evidence to suggest that they can lower costs for employers. When workers indulge in unhealthy habits and get chronically sick, lost productivity and expensive medical bills can quickly add up.

The flipside, particularly at companies that stress diversity, is that employees are in very different situations. Think about a new mother who's juggling sleepless nights compared to a single developer just out of college. People also have varying dietary needs.

Shah, who spoke with CNBC on Monday, said that his employees had input into the company's policies and tested them for more than a year. The ban on sugar, he said, was suggested by one employee who had trouble resisting leftover birthday cake on the kitchen table. As an alternative, the company provides things like nuts, fruit and popcorn. Anyone can keep chocolate or other sweets at their desk.

The fundamental motivation is not to discriminate but to provide a more unified workplace, he said, by encouraging employees to take time during the day to meditate or take a walk. He said he would pay them for that time off for hourly and salaried employees.

Shah also said he's putting more thought into the nuances and the potential unintended consequences of this type of culture. For example, studies have found that there's a huge stigma at American workplaces against people who are overweight or obese and that companies with a significant focus on being healthy may be further alienating them.

For Shah, the company's next chapter will involve a lot more inclusion.

Not that he's getting rid of all the health hoopla. On its careers page, Health IQ still promotes mid-day yoga and fitness classes, healthy snacks and "weekly office-wide standups where each person spends ten seconds on what they've accomplished that week."