You are here

README.txt in Resource Hints 7.2

Same filename and directory in other branches
  1. 7 README.txt
# Resource Hints

Configure resource hints for better user agent performance

https://www.w3.org/TR/resource-hints/

## Instructions

Unpack in the *modules* folder (currently in the root of your Drupal installation) and enable in `/admin/modules`.

Then, visit `/admin/config/development/resource-hints` and enter your own set of configurations for the various resource hint types.

## Contributing

Please follow the standards as explained in the Examples for Developers module:

http://cgit.drupalcode.org/examples/tree/STANDARDS.md

### PHPCS using Drupal standard

```shell
# From drupal root - please adjust to your environment
$ vendor/bin/phpcs -p -s --standard=Drupal sites/all/modules/resource_hints/*.{install,module,inc}
..

Time: 97ms; Memory: 8Mb
```

### Tests

```shell
# From drupal root - please adjust to your environment
$ php ./scripts/run-tests.sh --color --verbose --url http://127.0.0.1:8081/ --class ResourceHintsWebTestCase

Drupal test run
---------------

Tests to be run:
 - Resources Hints Web Test Case (ResourceHintsWebTestCase)

Test run started:
 Sunday, January 15, 2017 - 21:10

Test summary
------------

Resources Hints Web Test Case 48 passes, 1 fail, 0 exceptions, and 18 debug messages

Test run duration: 3 sec

Detailed test results
---------------------


---- ResourceHintsWebTestCase ----


Status    Group      Filename          Line Function
--------------------------------------------------------------------------------
Pass      Other      resource_hints.te   29 ResourceHintsWebTestCase->setUp()
    Enabled modules: resource_hints
Pass      Role       resource_hints.te   36 ResourceHintsWebTestCase->setUp()
    Created role of name: tYCFctQh, id: 3
Pass      Role       resource_hints.te   36 ResourceHintsWebTestCase->setUp()
    Created permissions: access administration pages, administer nodes,
    administer site configuration, administer resource hints
Pass      User login resource_hints.te   36 ResourceHintsWebTestCase->setUp()
    User created with name zq8zLLzP and pass mRde6J6oES
Pass      Browser    resource_hints.te   38 ResourceHintsWebTestCase->setUp()
    GET http://127.0.0.1:8081/user returned 200 (5.89 KB).
Pass      Browser    resource_hints.te   38 ResourceHintsWebTestCase->setUp()
    Valid HTML found on "http://127.0.0.1:8081/user"
Pass      Browser    resource_hints.te   38 ResourceHintsWebTestCase->setUp()
    GET http://127.0.0.1:8081/user/2 returned 200 (5.14 KB).
Pass      Browser    resource_hints.te   38 ResourceHintsWebTestCase->setUp()
    Valid HTML found on "http://127.0.0.1:8081/user/2"
Pass      User login resource_hints.te   38 ResourceHintsWebTestCase->setUp()
    User zq8zLLzP successfully logged in.
Pass      Browser    resource_hints.te   49 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.48 KB).
Pass      Browser    resource_hints.te   49 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   49 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.77 KB).
Pass      Browser    resource_hints.te   49 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   53 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.54 KB).
Pass      Browser    resource_hints.te   53 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   53 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.72 KB).
Pass      Browser    resource_hints.te   53 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   54 ResourceHintsWebTestCase->testResou
    Value '<//drupal.org>; rel=dns-prefetch' is TRUE.
Pass      Browser    resource_hints.te   58 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.49 KB).
Pass      Browser    resource_hints.te   58 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   58 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.78 KB).
Pass      Browser    resource_hints.te   58 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   59 ResourceHintsWebTestCase->testResou
    Raw "<link rel="preconnect" href="//drupal.org"
    />" found
Pass      Browser    resource_hints.te   62 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.55 KB).
Pass      Browser    resource_hints.te   62 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   62 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.74 KB).
Pass      Browser    resource_hints.te   62 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   63 ResourceHintsWebTestCase->testResou
    Value '<//drupal.org>; rel=preconnect' is TRUE.
Pass      Browser    resource_hints.te   67 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.5 KB).
Pass      Browser    resource_hints.te   67 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   67 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.79 KB).
Pass      Browser    resource_hints.te   67 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   68 ResourceHintsWebTestCase->testResou
    Raw "<link rel="prefetch" href="//drupal.org" />"
    found
Pass      Browser    resource_hints.te   71 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.56 KB).
Pass      Browser    resource_hints.te   71 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   71 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.75 KB).
Pass      Browser    resource_hints.te   71 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   72 ResourceHintsWebTestCase->testResou
    Value '<//drupal.org>; rel=prefetch' is TRUE.
Pass      Browser    resource_hints.te   76 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.51 KB).
Pass      Browser    resource_hints.te   76 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   76 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.8 KB).
Pass      Browser    resource_hints.te   76 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   77 ResourceHintsWebTestCase->testResou
    Raw "<link rel="prerender" href="//drupal.org" />"
    found
Pass      Browser    resource_hints.te   80 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.57 KB).
Pass      Browser    resource_hints.te   80 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Browser    resource_hints.te   80 ResourceHintsWebTestCase->testResou
    GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
    200 (11.76 KB).
Pass      Browser    resource_hints.te   80 ResourceHintsWebTestCase->testResou
    Valid HTML found on
    "http://127.0.0.1:8081/admin/config/development/resources-hints"
Pass      Other      resource_hints.te   81 ResourceHintsWebTestCase->testResou
    Value '<//drupal.org>; rel=prerender' is TRUE.
Fail      Other      run-tests.sh       386 simpletest_script_run_one_test()
    Failed to find test tables to drop.
```

## Helpful resources

https://www.w3.org/TR/resource-hints/
https://www.igvita.com/2015/08/17/eliminating-roundtrips-with-preconnect/
https://css-tricks.com/prefetching-preloading-prebrowsing/
https://medium.com/@luisvieira_gmr/html5-prefetch-1e54f6dda15d#.liri85j7v
https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
https://www.w3.org/TR/html4/types.html#type-links

File

README.txt
View source
  1. # Resource Hints
  2. Configure resource hints for better user agent performance
  3. https://www.w3.org/TR/resource-hints/
  4. ## Instructions
  5. Unpack in the *modules* folder (currently in the root of your Drupal installation) and enable in `/admin/modules`.
  6. Then, visit `/admin/config/development/resource-hints` and enter your own set of configurations for the various resource hint types.
  7. ## Contributing
  8. Please follow the standards as explained in the Examples for Developers module:
  9. http://cgit.drupalcode.org/examples/tree/STANDARDS.md
  10. ### PHPCS using Drupal standard
  11. ```shell
  12. # From drupal root - please adjust to your environment
  13. $ vendor/bin/phpcs -p -s --standard=Drupal sites/all/modules/resource_hints/*.{install,module,inc}
  14. ..
  15. Time: 97ms; Memory: 8Mb
  16. ```
  17. ### Tests
  18. ```shell
  19. # From drupal root - please adjust to your environment
  20. $ php ./scripts/run-tests.sh --color --verbose --url http://127.0.0.1:8081/ --class ResourceHintsWebTestCase
  21. Drupal test run
  22. ---------------
  23. Tests to be run:
  24. - Resources Hints Web Test Case (ResourceHintsWebTestCase)
  25. Test run started:
  26. Sunday, January 15, 2017 - 21:10
  27. Test summary
  28. ------------
  29. Resources Hints Web Test Case 48 passes, 1 fail, 0 exceptions, and 18 debug messages
  30. Test run duration: 3 sec
  31. Detailed test results
  32. ---------------------
  33. ---- ResourceHintsWebTestCase ----
  34. Status Group Filename Line Function
  35. --------------------------------------------------------------------------------
  36. Pass Other resource_hints.te 29 ResourceHintsWebTestCase->setUp()
  37. Enabled modules: resource_hints
  38. Pass Role resource_hints.te 36 ResourceHintsWebTestCase->setUp()
  39. Created role of name: tYCFctQh, id: 3
  40. Pass Role resource_hints.te 36 ResourceHintsWebTestCase->setUp()
  41. Created permissions: access administration pages, administer nodes,
  42. administer site configuration, administer resource hints
  43. Pass User login resource_hints.te 36 ResourceHintsWebTestCase->setUp()
  44. User created with name zq8zLLzP and pass mRde6J6oES
  45. Pass Browser resource_hints.te 38 ResourceHintsWebTestCase->setUp()
  46. GET http://127.0.0.1:8081/user returned 200 (5.89 KB).
  47. Pass Browser resource_hints.te 38 ResourceHintsWebTestCase->setUp()
  48. Valid HTML found on "http://127.0.0.1:8081/user"
  49. Pass Browser resource_hints.te 38 ResourceHintsWebTestCase->setUp()
  50. GET http://127.0.0.1:8081/user/2 returned 200 (5.14 KB).
  51. Pass Browser resource_hints.te 38 ResourceHintsWebTestCase->setUp()
  52. Valid HTML found on "http://127.0.0.1:8081/user/2"
  53. Pass User login resource_hints.te 38 ResourceHintsWebTestCase->setUp()
  54. User zq8zLLzP successfully logged in.
  55. Pass Browser resource_hints.te 49 ResourceHintsWebTestCase->testResou
  56. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  57. 200 (11.48 KB).
  58. Pass Browser resource_hints.te 49 ResourceHintsWebTestCase->testResou
  59. Valid HTML found on
  60. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  61. Pass Browser resource_hints.te 49 ResourceHintsWebTestCase->testResou
  62. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  63. 200 (11.77 KB).
  64. Pass Browser resource_hints.te 49 ResourceHintsWebTestCase->testResou
  65. Valid HTML found on
  66. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  67. Pass Browser resource_hints.te 53 ResourceHintsWebTestCase->testResou
  68. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  69. 200 (11.54 KB).
  70. Pass Browser resource_hints.te 53 ResourceHintsWebTestCase->testResou
  71. Valid HTML found on
  72. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  73. Pass Browser resource_hints.te 53 ResourceHintsWebTestCase->testResou
  74. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  75. 200 (11.72 KB).
  76. Pass Browser resource_hints.te 53 ResourceHintsWebTestCase->testResou
  77. Valid HTML found on
  78. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  79. Pass Other resource_hints.te 54 ResourceHintsWebTestCase->testResou
  80. Value '<//drupal.org>; rel=dns-prefetch' is TRUE.
  81. Pass Browser resource_hints.te 58 ResourceHintsWebTestCase->testResou
  82. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  83. 200 (11.49 KB).
  84. Pass Browser resource_hints.te 58 ResourceHintsWebTestCase->testResou
  85. Valid HTML found on
  86. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  87. Pass Browser resource_hints.te 58 ResourceHintsWebTestCase->testResou
  88. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  89. 200 (11.78 KB).
  90. Pass Browser resource_hints.te 58 ResourceHintsWebTestCase->testResou
  91. Valid HTML found on
  92. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  93. Pass Other resource_hints.te 59 ResourceHintsWebTestCase->testResou
  94. Raw "<link rel="preconnect" href="//drupal.org"
  95. />" found
  96. Pass Browser resource_hints.te 62 ResourceHintsWebTestCase->testResou
  97. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  98. 200 (11.55 KB).
  99. Pass Browser resource_hints.te 62 ResourceHintsWebTestCase->testResou
  100. Valid HTML found on
  101. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  102. Pass Browser resource_hints.te 62 ResourceHintsWebTestCase->testResou
  103. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  104. 200 (11.74 KB).
  105. Pass Browser resource_hints.te 62 ResourceHintsWebTestCase->testResou
  106. Valid HTML found on
  107. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  108. Pass Other resource_hints.te 63 ResourceHintsWebTestCase->testResou
  109. Value '<//drupal.org>; rel=preconnect' is TRUE.
  110. Pass Browser resource_hints.te 67 ResourceHintsWebTestCase->testResou
  111. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  112. 200 (11.5 KB).
  113. Pass Browser resource_hints.te 67 ResourceHintsWebTestCase->testResou
  114. Valid HTML found on
  115. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  116. Pass Browser resource_hints.te 67 ResourceHintsWebTestCase->testResou
  117. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  118. 200 (11.79 KB).
  119. Pass Browser resource_hints.te 67 ResourceHintsWebTestCase->testResou
  120. Valid HTML found on
  121. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  122. Pass Other resource_hints.te 68 ResourceHintsWebTestCase->testResou
  123. Raw "<link rel="prefetch" href="//drupal.org" />"
  124. found
  125. Pass Browser resource_hints.te 71 ResourceHintsWebTestCase->testResou
  126. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  127. 200 (11.56 KB).
  128. Pass Browser resource_hints.te 71 ResourceHintsWebTestCase->testResou
  129. Valid HTML found on
  130. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  131. Pass Browser resource_hints.te 71 ResourceHintsWebTestCase->testResou
  132. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  133. 200 (11.75 KB).
  134. Pass Browser resource_hints.te 71 ResourceHintsWebTestCase->testResou
  135. Valid HTML found on
  136. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  137. Pass Other resource_hints.te 72 ResourceHintsWebTestCase->testResou
  138. Value '<//drupal.org>; rel=prefetch' is TRUE.
  139. Pass Browser resource_hints.te 76 ResourceHintsWebTestCase->testResou
  140. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  141. 200 (11.51 KB).
  142. Pass Browser resource_hints.te 76 ResourceHintsWebTestCase->testResou
  143. Valid HTML found on
  144. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  145. Pass Browser resource_hints.te 76 ResourceHintsWebTestCase->testResou
  146. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  147. 200 (11.8 KB).
  148. Pass Browser resource_hints.te 76 ResourceHintsWebTestCase->testResou
  149. Valid HTML found on
  150. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  151. Pass Other resource_hints.te 77 ResourceHintsWebTestCase->testResou
  152. Raw "<link rel="prerender" href="//drupal.org" />"
  153. found
  154. Pass Browser resource_hints.te 80 ResourceHintsWebTestCase->testResou
  155. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  156. 200 (11.57 KB).
  157. Pass Browser resource_hints.te 80 ResourceHintsWebTestCase->testResou
  158. Valid HTML found on
  159. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  160. Pass Browser resource_hints.te 80 ResourceHintsWebTestCase->testResou
  161. GET http://127.0.0.1:8081/admin/config/development/resources-hints returned
  162. 200 (11.76 KB).
  163. Pass Browser resource_hints.te 80 ResourceHintsWebTestCase->testResou
  164. Valid HTML found on
  165. "http://127.0.0.1:8081/admin/config/development/resources-hints"
  166. Pass Other resource_hints.te 81 ResourceHintsWebTestCase->testResou
  167. Value '<//drupal.org>; rel=prerender' is TRUE.
  168. Fail Other run-tests.sh 386 simpletest_script_run_one_test()
  169. Failed to find test tables to drop.
  170. ```
  171. ## Helpful resources
  172. https://www.w3.org/TR/resource-hints/
  173. https://www.igvita.com/2015/08/17/eliminating-roundtrips-with-preconnect/
  174. https://css-tricks.com/prefetching-preloading-prebrowsing/
  175. https://medium.com/@luisvieira_gmr/html5-prefetch-1e54f6dda15d#.liri85j7v
  176. https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ
  177. https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
  178. https://www.w3.org/TR/html4/types.html#type-links