The scientific consensus was worse than "fat is bad for you", it was saturated fat is bad, so switch from butter to trans fat loaded margarine. It lead to things like McDonalds using hydrogenated vegetable oil instead of saturated fat laden beef tallow in their fryers. The scientific consensus was specifically wrong on the types of fat that were bad.
> The scientific consensus was worse than "fat is bad for you", it was saturated fat is bad, so switch from butter to trans fat loaded margarine.
That recommendation was never "the scientific consensus" -- for most of the time after saturated fat was identified as a concern and before trans fats were identified as a specific concern, the scientific consensus was that the best change was to eliminate the saturated fats and not replace them, since most people that were getting too much saturated fats were also getting too many calories and too much of their intake in the form of fat of any kind.
Obviously, marketers of alternative fat products had a different viewpoint.
And, actually, the scientific consensus still seems to mostly be that saturated fat is bad from a cardiovascular disease perspective, what has mostly evolved is that trans fats and carbohydrates as replacements now appear to be equally bad, and the value of monounsaturated fats as replacements is unclear -- studies focusing on replacement show that replacing saturated fats with polyunsatured fats generally is beneficial. There's also some reason to think that more research is needed on particular kinds of saturated fats, and that there may be significant differences between them (milk fat may be beneficial, for instance.)
Insufficient evidence (≤2 criteria) of association is present for intake of supplementary vitamin E and ascorbic acid (vitamin C); saturated and polyunsaturated fatty acids; total fat;
Reduced or modified dietary fat for preventing cardiovascular disease