-
Notifications
You must be signed in to change notification settings - Fork 66
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
18 changed files
with
11,132 additions
and
19,725 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 @@ | ||
last 2 years |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,13 @@ | ||
{ | ||
"name": "DocHub", | ||
"short_name": "DocHub", | ||
"orientation": "portrait", | ||
"display": "standalone", | ||
"start_url": ".", | ||
"description": "Actitecture as a code", | ||
"background_color": "#ffffff", | ||
"plugins": [ | ||
"/plugins/html.js", | ||
"/plugins/svg.js" | ||
] | ||
} |
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,32 @@ | ||
const pluginName = 'PluginMakerWebpackPlugin'; | ||
|
||
const { ConcatSource } = require('webpack-sources'); | ||
|
||
module.exports = class PluginMakerWebpackPlugin { | ||
constructor(options) { | ||
this.options = Object.assign(options || {}, { | ||
filer: /^plugins\/.*\.js$/ | ||
}); | ||
this.options.test = new RegExp(this.options.test); | ||
} | ||
apply(compiler) { | ||
compiler.hooks.compilation.tap(pluginName, compilation => { | ||
compilation.hooks.processAssets.tap( | ||
{ | ||
name: pluginName, | ||
stage: compilation.PROCESS_ASSETS_STAGE_ADDITIONS | ||
}, | ||
() => { | ||
for (const chunk of compilation.chunks) { | ||
for (const file of chunk.files) { | ||
if (this.options.filer.test(file)) { | ||
compilation.updateAsset(file, old => { | ||
return new ConcatSource('(function (DocHub){', old, '})(window.DocHub);'); | ||
}); | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.