javascript - Prettier ignore handlebars - Stack Overflow

I have the following folder structure in my Meteor project.> .meteor>public> client (dir)>

I have the following folder structure in my Meteor project.

> .meteor

>public

> client (dir)
>> foo.html &
>> foo.js

>> bar (dir: client/bar)
>>> bar.html &
>>> bar.js

> server
>> baz.js

I want to format all JS files inside of client directory

npx prettier --write 'client/**/*.js'

only formats files like bar.js. In reality I have up to 5 levels deep folders, and they need to be formatted too.

npx prettier --write 'client/**'

Works, but affects html (handlebar) files, I want to avoid that.

Any ideas? I can't find anything in the documentation, a part from manually adding an ignore to all .html files but that's an overkill.

I have the following folder structure in my Meteor project.

> .meteor

>public

> client (dir)
>> foo.html &
>> foo.js

>> bar (dir: client/bar)
>>> bar.html &
>>> bar.js

> server
>> baz.js

I want to format all JS files inside of client directory

npx prettier --write 'client/**/*.js'

only formats files like bar.js. In reality I have up to 5 levels deep folders, and they need to be formatted too.

npx prettier --write 'client/**'

Works, but affects html (handlebar) files, I want to avoid that.

Any ideas? I can't find anything in the documentation, a part from manually adding an ignore to all .html files but that's an overkill.

Share Improve this question asked Aug 24, 2021 at 11:01 AlexAlex 1,4204 gold badges22 silver badges40 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

Add a .prettierignore file to your project root to ignore handlebars files, e. g.:

*.handlebars

You can add the following config to avoid handlebars (.hbs) formatting

"[handlebars]": {
    "editor.formatOnSave": false,
    "editor.formatOnPaste": false
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745402840a4626180.html

相关推荐

  • javascript - Prettier ignore handlebars - Stack Overflow

    I have the following folder structure in my Meteor project.> .meteor>public> client (dir)>

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信