From 2adfce302f6a9f18598c0357f8d797e0336a4069 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 7 May 2020 18:25:37 +0100 Subject: [PATCH] initial fork --- .github/CONTRIBUTING.md | 43 ----------------------------- .github/PULL_REQUEST_TEMPLATE.md | 6 ---- .stylelintrc.json | 32 +++++++++++++--------- README.md | 8 +++++- SETUP | 47 ++++++++++++++++++++++++++++++++ package.json | 15 ++++++++-- 6 files changed, 85 insertions(+), 66 deletions(-) delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100755 SETUP diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index a1a84483..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,43 +0,0 @@ -Thanks for contributing to `_s` (Underscores) — you rock! - -## Maintainers - -`_s` is maintained by the [Automattic Theme Team](https://themeshaper.com/about/). - -## Reporting issues - -Before submitting your issue, make sure it has not been discussed earlier. You can search for existing tickets [here](https://github.com/Automattic/_s/search). - -Here are some tips to consider and to help you write a great report: - -* `_s` supports Microsoft Internet Explorer 11 and Edge, as well as the latest two versions of all other major browsers. -* `_s` is backwards compatible with the two versions prior to the current stable version of WordPress. -* `_s` uses HTML5 markup. -* We decided not to include translations [[#50](https://github.com/Automattic/_s/pull/50)] beyond the existing `_s.pot` file, a RTL stylesheet [[#263](https://github.com/Automattic/_s/pull/263)], or editor styles [[#225](https://github.com/Automattic/_s/pull/225)], as they are likely to change during development of an `_s` based theme. - -## Sending a Pull Request - -Found a bug you can fix? Fantastic! Patches are always welcome. Here's a few tips for crafting a great pull request: - -* Include the purpose of your PR. Be explicit about the issue your PR solves. -* Reference any existing issues that relate to your PR. This allows everyone to easily see all related discussions. -* `_s` complies with the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) and any PR should comply as well. - -### Before submitting a pull request, please make sure the following is done: - -1. Fork the repo and create your branch from master. -2. Run `npm install` and `composer install`. -3. When submitting a change that affects SCSS sources, please make sure there is no linting errors using `npm run lint:scss`, then generate the css files using `npm run compile:css` and `npm run compile:rtl`. -4. When submitting a change that affects PHP files, please make sure there is no syntax or linting errors by running `composer lint:php` then `composer lint:wpcs`. -5. When submitting a change that affects JS files, please make sure there is no linting errors by running `npm run lint:js`. -6. When submitting a change that affects text strings, make sure to regenerate the POT file by running `composer make-pot`. - -By contributing code to `_s`, you grant its use under the [GNU General Public License v2 (or later)](LICENSE). - -## Underscores.me - -If your issue is specific to the [Underscores.me](https://underscores.me) website, the [Underscores.me GitHub repo](https://github.com/Automattic/underscores.me) is the right place for you. - -The preferred method of generating a new theme based on `_s` is the [Underscores.me](https://underscores.me) website. If you have an alternative method, such as a shell script, write a blog post about it or host it in a separate repo -- and make sure to mention [@underscoresme](https://twitter.com/underscoresme) in your tweets! - -Want to have your avatar listed as one of the `_s` contributors [here](https://underscores.me/#contribute)? Just make sure you have an email address added to both GitHub and your local Git installation. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index fdae1feb..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,6 +0,0 @@ - - -#### Changes proposed in this Pull Request: - - -#### Related issue(s): \ No newline at end of file diff --git a/.stylelintrc.json b/.stylelintrc.json index 55b598d8..843ee3e3 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,15 +1,21 @@ { - "extends": [ - "stylelint-config-wordpress/scss" - ], - "ignoreFiles": [ - "sass/_normalize.scss" - ], - "rules": { - "font-family-no-missing-generic-family-keyword": null, - "no-descending-specificity": null, - "block-no-empty": null, - "no-duplicate-selectors": null, - "font-family-no-duplicate-names": null - } + "extends": [ + "stylelint-config-wordpress/scss" + ], + "ignoreFiles": [ + "sass/_normalize.scss" + ], + "rules": { + "block-no-empty": null, + "no-duplicate-selectors": null, + "font-family-no-duplicate-names": null, + "declaration-block-no-duplicate-properties": [ + true, + { + "ignore": [ + "consecutive-duplicates" + ] + } + ] + } } diff --git a/README.md b/README.md index d2beab0f..7559fdef 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -[![Build Status](https://travis-ci.org/Automattic/_s.svg?branch=master)](https://travis-ci.org/Automattic/_s) +Changes from Upstream +--------------------- + +* Added 'autoprefixer'. +* Added 'dev' script - this also watches for `scss` changes - `npm run dev` +* Run `SETUP` to set theme up with correct name and npm and composer dependencies +installed. _s === diff --git a/SETUP b/SETUP new file mode 100755 index 00000000..3f15b918 --- /dev/null +++ b/SETUP @@ -0,0 +1,47 @@ +#!/bin/sh + +if [ -z "$1" ] ; then + _name=${PWD##*/} + if [ -z "$_name" ] ; then + echo "Error - could not determine theme name" + echo "Please rerun and pass theme name as an argument." + exit 1 + fi +else + _name="$1" +fi + +_name_uppercase="$(echo "$_name" | tr '[:lower:]' '[:upper:]')" + +# search and replace + +find . -type f -name "*.*" -print0 | xargs -0 sed -i '' -e s/\'_s\'/"'$_name'"/g +find . -type f -name "*.*" -print0 | xargs -0 sed -i '' -e 's/_s_/'"$_name"'_/g' +find . -type f -name "*.*" -print0 | xargs -0 sed -i '' -e 's/Text Domain: _s/Text Domain: '"$_name"'/g' +find . -type f -name "*.*" -print0 | xargs -0 sed -i '' -e 's/ _s/ '"$_name"'/g' +find . -type f -name "*.*" -print0 | xargs -0 sed -i '' -e 's/_s-/'"$_name"'-/g' +find . -type f -name "*.*" -print0 | xargs -0 sed -i '' -e 's/_S_/'"$_name_uppercase"'_/g' + +# install composer +# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md +EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + +if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] +then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 10 +fi + +php composer-setup.php --quiet +RESULT=$? +rm composer-setup.php +exit $RESULT + +php composer.phar install + +# npm install + +npm install diff --git a/package.json b/package.json index c632f656..878f5b2b 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,11 @@ "@wordpress/scripts": "^9.0.0", "archiver": "^4.0.1", "node-sass": "^4.14.0", - "rtlcss": "^2.5.0" + "rtlcss": "^2.5.0", + "autoprefixer": "^9.7.6", + "chokidar-cli": "^2.1.0", + "npm-run-all": "^4.1.5", + "postcss-cli": "^7.1.1" }, "rtlcssConfig": { "options": { @@ -36,10 +40,15 @@ "map": false }, "scripts": { - "compile:css": "node-sass sass/style.scss style.css && node-sass sass/woocommerce.scss woocommerce.css && stylelint '*.css' --fix || true && stylelint '*.css' --fix", + "compile:css": "node-sass --source-map true sass/style.scss style.css && node-sass --source-map true sass/woocommerce.scss woocommerce.css && stylelint '*.css' --fix || true && stylelint '*.css' --fix", "compile:rtl": "rtlcss style.css style-rtl.css", "lint:scss": "wp-scripts lint-style 'sass/**/*.scss'", "lint:js": "wp-scripts lint-js 'js/*.js'", - "bundle": "node bin/bundle.js" + "bundle": "node bin/bundle.js", + "build-task:scss-compile": "npm-run-all -p compile:*", + "build-task:autoprefixer": "postcss *.css --use autoprefixer --replace", + "sass:build": "npm-run-all -s build-task:scss-compile build-task:autoprefixer", + "sass:watch": "chokidar 'sass/**/*.scss' -c 'npm run sass:build'", + "dev": "npm-run-all -p sass:*" } }