-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
433 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; http://editorconfig.org | ||
; | ||
; Sublime: https://github.com/sindresorhus/editorconfig-sublime | ||
; Phpstorm: https://plugins.jetbrains.com/plugin/7294-editorconfig | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[{*.js,*.css,*.scss,*.html}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files | ||
|
||
language: php | ||
|
||
php: | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
- nightly | ||
|
||
matrix: | ||
allow_failures: | ||
- php: nightly | ||
|
||
install: | ||
- composer install --prefer-dist | ||
|
||
before_script: | ||
- for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done | ||
|
||
script: | ||
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.0 2019-12-07 10:41:54 UTC | ||
|
||
- init library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
## How to contribute | ||
|
||
### Before you start | ||
|
||
<!-- This section contains conventions/standards contributors must follow --> | ||
<!-- For example: Commit messages should follow angular standard --> | ||
|
||
### Setting up | ||
|
||
You may need to fork this project in [GitHub](https://github.com/adhocore/twig-yall). | ||
|
||
```sh | ||
git clone git@github.com:adhocore/twig-yall.git | ||
|
||
# OR if you have a fork | ||
git clone git@github.com:<your_github_handle>/twig-yall.git | ||
|
||
# You may also add upstream | ||
git remote add upstream https://github.com/adhocore/twig-yall.git | ||
|
||
cd twig-yall | ||
|
||
# Create a new branch | ||
git checkout -b $branch_name | ||
|
||
# Install deps | ||
composer install -o | ||
``` | ||
|
||
### Moving forward | ||
|
||
```sh | ||
# Open twig-yall in IDE | ||
subl twig-yall | ||
|
||
# ... and do the needful | ||
|
||
# Optionally run the lint | ||
for P in src tests; do find $P -type f -name '*.php' -exec php -l {} \;; done | ||
|
||
# ... and phpcs fixer or stuffs like that! | ||
|
||
# Run tests | ||
vendor/bin/phpunit --coverage-text | ||
|
||
|
||
# If your feature takes long your dev branch might be out of sync, you may want to | ||
git checkout $branch_name | ||
git pull upstream master # branch could be something else than master | ||
``` | ||
|
||
### Finalizing | ||
|
||
Everything looking good? | ||
|
||
```sh | ||
# Commit your stuffs | ||
git add $file ...$files | ||
git commit -m "..." | ||
|
||
# Push 'em | ||
git push origin HEAD | ||
``` | ||
|
||
Now goto [GitHub](https://github.com/adhocore/twig-yall/compare?expand=1), select your branch and create PR. | ||
|
||
### Getting PR merged | ||
|
||
You have to wait. You have to address change requests. Be patient. | ||
|
||
Thank you for contribution! | ||
|
||
**Lastly** Please be informed that your works will be licensed same as the project [license](./LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Jitendra Adhikari | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## adhocore/twig-yall | ||
|
||
[](https://github.com/adhocore/twig-yall/releases) | ||
[](https://travis-ci.com/adhocore/twig-yall?branch=master) | ||
[](https://scrutinizer-ci.com/g/adhocore/twig-yall/?branch=master) | ||
[](https://codecov.io/gh/adhocore/twig-yall) | ||
[](https://styleci.io/repos/{styleci}) | ||
[](./LICENSE) | ||
|
||
|
||
## Installation | ||
```bash | ||
composer require adhocore/twig-yall | ||
``` | ||
|
||
## Usage | ||
In twig template you would do something like this: | ||
|
||
```twig | ||
<img {{ lazy('path/to/image.jpg', 'class1 class2') }} alt="something" /> | ||
``` | ||
Then it will be rendered as: | ||
|
||
```html | ||
<!-- indented into multiline for clarity only --> | ||
<img src="path/to/placeholder.gif" | ||
data-src="path/to/image.jpg" | ||
class="lazy class1 class2" | ||
alt="something" /> | ||
``` | ||
|
||
Donot forget to put the yall loader somewhere in the footer: | ||
```twig | ||
{% yallify %} | ||
``` | ||
|
||
## API | ||
|
||
<!-- DOCS START --> | ||
<!-- DOCS END --> | ||
|
||
## Contributing | ||
|
||
Please check [the guide](./CONTRIBUTING.md) | ||
|
||
## LICENSE | ||
|
||
> © [MIT](./LICENSE) | 2019, Jitendra Adhikari |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "adhocore/twig-yall", | ||
"description": "Lazy load image in twig using malchata/yall.js", | ||
"type": "library", | ||
"keywords": ["php","twig-yall"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Jitendra Adhikari", | ||
"email": "jiten.adhikary@gmail.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Ahc\\TwigYall\\": "src/" | ||
}, | ||
"files": [] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Ahc\\TwigYall\\Test\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=7.0.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^6.5 || ^7.5", | ||
"twig/twig": "^1.42" | ||
}, | ||
"config": { | ||
"optimize-autoloader": true, | ||
"preferred-install": { | ||
"*": "dist" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit --coverage-text" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## Introduction | ||
|
||
**This is a** | ||
|
||
<!-- Put a cross `x` in one of the below boxes --> | ||
- [ ] Bug/Issue | ||
- [ ] Feature request | ||
- [ ] General stuff | ||
|
||
<!-- BugStart (Remove this line if reporting bug) | ||
## Describe the bug/issue | ||
I wanted to ... | ||
### What happened | ||
... | ||
### What is expected | ||
... | ||
### Reproduction steps | ||
- ... | ||
### Sample code | ||
### Environment | ||
- OS: | ||
- PHP version: | ||
- twig-yall version: | ||
BugEnd (Remove this line if reporting bug) --> | ||
|
||
<!-- FeatureStart (Remove this line if requesting feature) | ||
## Explain the feature | ||
FeatureEnd (Remove this line if requesting feature) --> | ||
|
||
<!-- GeneralStart (Remove this line if it is general concern) | ||
## Explain yourself | ||
... | ||
GeneralEnd (Remove this line if it is general concern) --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Introduction | ||
|
||
**This is a** | ||
|
||
<!-- Put a cross `x` in relevant boxes below --> | ||
- [ ] New feature | ||
- [ ] Fix for ... <!-- (the issue/bug) --> | ||
- [ ] General improvement | ||
- [ ] Backward incompatible change | ||
|
||
It closes # <!-- (Put the issue number after `#`) --> | ||
|
||
## Describe the change | ||
|
||
... | ||
|
||
## How to use it | ||
|
||
... | ||
|
||
#### Sample code | ||
|
||
```php | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
bootstrap="tests/bootstrap.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Twig-yall Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
Oops, something went wrong.