Skip to content

Commit

Permalink
Merge branch 'release/1.0.5' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Sep 28, 2018
2 parents 32b1a40 + 0e4ffef commit 3bfaf66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Twigpack Changelog

## 1.0.5 - 2018-09-28
### Changed
* Check via `empty()` rather than `!== null` when checking the manifest for module entries
* CSS module loading generates a soft error now, rather than throwing an `NotFoundHttpException`

## 1.0.4 - 2018-09-28
### Added
* Added `this.onload=null;` to async CSS link tag
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-twigpack",
"description": "Twigpack is a bridge between Twig and webpack, with manifest.json & webpack-dev-server HMR support",
"type": "craft-plugin",
"version": "1.0.4",
"version": "1.0.5",
"keywords": [
"craftcms",
"craft-plugin",
Expand Down
9 changes: 5 additions & 4 deletions src/helpers/Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Manifest
*/
public static function getCssModuleTags(array $config, string $moduleName, bool $async)
{
$legacyModule = self::getModule($config, $moduleName, 'legacy');
$legacyModule = self::getModule($config, $moduleName, 'legacy', true);
if ($legacyModule === null) {
return '';
}
Expand Down Expand Up @@ -151,11 +151,12 @@ public static function getSafariNomoduleFix(): string
* @param array $config
* @param string $moduleName
* @param string $type
* @param bool $soft
*
* @return null|string
* @throws NotFoundHttpException
*/
public static function getModule(array $config, string $moduleName, string $type = 'modern')
public static function getModule(array $config, string $moduleName, string $type = 'modern', bool $soft = false)
{
$module = null;
// Determine whether we should use the devServer for HMR or not
Expand All @@ -165,12 +166,12 @@ public static function getModule(array $config, string $moduleName, string $type
$manifest = self::getManifestFile($config, $isHot, $type);
if ($manifest !== null) {
// Make sure it exists in the manifest
if ($manifest[$moduleName] === null) {
if (empty($manifest[$moduleName])) {
self::reportError(Craft::t(
'twigpack',
'Module does not exist in the manifest: {moduleName}',
['moduleName' => $moduleName]
));
), $soft);

return null;
}
Expand Down

0 comments on commit 3bfaf66

Please sign in to comment.