Story highlights Limits set for fat, salt and sugar in food sold in vending machines, snack bars, etc.

Candy bars, doughnuts, regular potato chips and sports drinks are out

Granola bars, trail mix, baked chips, low-fat and fat-free milk, fruit and vegetable juices are in

The new rules are meant to help curb childhood obesity

Candy bars, doughnuts and regular potato chips will become scarce in schools under new federal rules released Thursday , replaced by healthier options such as granola bars, trail mix and baked chips.

The U.S. Department of Agriculture's new "Smart Snacks in School" nutrition standards represent the first nutritional overhaul of school snacks in more than 30 years.

The regulations set limits for fat, salt and sugar sold in places such as vending machines and snack bars. School foods must contain at least 50% whole grains or have a fruit, vegetable, dairy or protein as the first ingredient. Foods that contain at least ¼ cup of fruit and/or vegetables will also be allowed.

Beverages will be under the microscope as well. Sports drinks that contain relatively high amounts of sugar are prohibited, but the low-calorie versions will be for sale. Low-fat and fat-free milk, 100% fruit and vegetable juice, and no-calorie flavored waters are permitted. Potable water must be made available to kids for free where meals are served.

Schools and food and beverage companies must meet these standards by July 1, 2014, according to the USDA. That means the rules would be in effect for the 2014-2015 school year.

"Snacks now have to be nutritious. They can't just be fortified junk," said Margo Wotton, director of nutrition policy at the Center for Science in the Public Interest, a consumer advocacy group.

JUST WATCHED Say goodbye to candy, donuts in school Replay More Videos ... MUST WATCH Say goodbye to candy, donuts in school 01:27

"Nothing is more important than the health and well-being of our children," USDA Secretary Tom Vilsack said in a statement. "Parents and schools work hard to give our youngsters the opportunity to grow up healthy and strong, and providing healthy options throughout school cafeterias, vending machines, and snack bars will support their great efforts."

Children will still be allowed to bring in any snacks from home that they choose, and parents can continue to deliver treats for birthday celebrations or holidays to the classroom. Special fund-raising events such as bake sales are also allowed.

The new rules are meant to help curb childhood obesity in the United States, which affects about 17% of children and adolescents , according to the Centers for Disease Control and Prevention.

"(The new regulations) seem like a big step in the right direction," wrote Stacy Whitman, a mom who blogs about school nutrition . "But I fear there still will be lots of room for less-than-healthy snacks to make their way into schools. While baked chips may be a better option than Doritos, they are still junk food. Granola and cereal bars may be viewed as nutritious, but most are infused with sugar and not exactly what I would call wholesome. And sugary yogurts and flavored milks sound like dessert in disguise."

The rules are a result of the Healthy and Hunger-Free Kids Act of 2010, which requires the USDA to improve food served in schools. The act was first implemented in 2012 with an overhaul of the meals served in schools under the National School Lunch Program.

Directors of the meal programs, which feed about 32 million students in public and private schools, were told to reduce sodium, saturated fat and trans fats and offer more whole grains. They were also instructed to start offering fruits and vegetables to students every day.

Those standards went into effect in July 2012 and are being phased in over a three-year period, according to the USDA.

School meals now have calorie minimums and maximums per meal based on a child's age. For kindergarteners to fifth-graders, lunches must contain 550 to 650 calories, and for ninth- to 12th-graders, lunches must have 750 to 850 calories.

Some students objected to the changes , complaining that their favorite foods were taken away or that the calorie restrictions were too low for growing teens. High school students in Kansas made a video called " We Are Hungry ," complete with feigned fainting that's been viewed more than 1 million times on YouTube.