-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS: Add package.json for linting and compiling #1159
Changes from 3 commits
3b576e6
9d783c0
aaf2c8b
561302f
fd9efee
275dcbb
baf9ec0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Dependency directories | ||
node_modules/ | ||
yarn.lock | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "_s", | ||
"version": "1.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a licence and repository field too. |
||
"scripts": { | ||
"css-build": "npm run css-lint && npm run css-compile && npm run css-prefix && npm run css-format && npm run css-fix", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to run |
||
"css-lint": "stylelint style.css", | ||
"css-compile": "node-sass sass/style.scss style.css --output-style expanded --indent-type tab --indent-width 1", | ||
"css-prefix": "postcss style.css -u autoprefixer -o style.css --no-map", | ||
"css-format": "stylefmt style.css", | ||
"css-fix": "stylelint style.css --fix", | ||
"scss-lint": "stylelint sass/**/*.scss --syntax scss" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this to The glob needs to be quoted and loads the SCSS config from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. Thanks @ntwb ! |
||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^7.1.4", | ||
"browserslist": "^2.4.0", | ||
"node-sass": "^4.5.3", | ||
"postcss-cli": "^4.1.1", | ||
"stylefmt": "^6.0.0", | ||
"stylelint": "^8.1.1", | ||
"stylelint-config-wordpress": "^12.0.0" | ||
}, | ||
"stylelint": { | ||
"defaultSeverity": "warning", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @grappler Not sure if this is wanted here?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am fine with leaving like this. We can look in the future to change the command to something like https://medium.com/@bjankord/how-to-lint-scss-with-stylelint-dc87809a9878 |
||
"extends": "stylelint-config-wordpress" | ||
}, | ||
"browserslist": [ | ||
"> 1%", | ||
"ie >= 11", | ||
"last 1 Android versions", | ||
"last 1 ChromeAndroid versions", | ||
"last 2 Chrome versions", | ||
"last 2 Firefox versions", | ||
"last 2 Safari versions", | ||
"last 2 iOS versions", | ||
"last 2 Edge versions", | ||
"last 2 Opera versions" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does
yarn.lock
get created? On my system I am only gettingpackage-lock.json
generate which we should ignore too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
yarn.lockfile is only generated if someone runs
yarn install`Likewise, a
package-lock.json
is only generated if you runnpm install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stumbled upon this while having my first contact with wordpress after long not touching it. Generally, the lock files are meant to be comitted. Is there any special reason you want to exclude them?
https://stackoverflow.com/questions/44206782/do-i-commit-the-package-lock-json-file-created-by-npm-5