-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Post Sticky Toggle: Improve the design
- Loading branch information
1 parent
36c71e5
commit 5c3ec04
Showing
5 changed files
with
57 additions
and
8 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,38 @@ | ||
module.exports = { | ||
name: 'json', | ||
setup( build ) { | ||
// Intercept import paths starting with "http:" and "https:" so | ||
// esbuild doesn't attempt to map them to a file system location. | ||
// Tag them with the "http-url" namespace to associate them with | ||
// this plugin. | ||
build.onResolve( { filter: /.*\.json/ }, ( args ) => ( { | ||
path: args.path, | ||
namespace: 'bundle-json', | ||
} ) ); | ||
|
||
// We also want to intercept all import paths inside downloaded | ||
// files and resolve them against the original URL. All of these | ||
// files will be in the "http-url" namespace. Make sure to keep | ||
// the newly resolved URL in the "http-url" namespace so imports | ||
// inside it will also be resolved as URLs recursively. | ||
build.onResolve( | ||
{ filter: /.*/, namespace: 'bundle-json' }, | ||
( args ) => ( { | ||
path: new URL( args.path, args.importer ).toString(), | ||
namespace: 'bundle-json', | ||
} ) | ||
); | ||
|
||
// When a URL is loaded, we want to actually download the content | ||
// from the internet. This has just enough logic to be able to | ||
// handle the example import from unpkg.com but in reality this | ||
// would probably need to be more complex. | ||
build.onLoad( | ||
{ filter: /.*/, namespace: 'bundle-json' }, | ||
async ( args ) => { | ||
const contents = require( args.path ); | ||
return { contents }; | ||
} | ||
); | ||
}, | ||
}; |
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,3 @@ | ||
.editor-post-sticky__toggle-control { | ||
padding: 6px 12px; | ||
} |
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