Sign in

User name:(required)

Password:(required)

Join Us

join us

Your Name:(required)

Your Email:(required)

Your Message :

0/2000

Developing your web extension with the best tools

Author: Minnie

Aug. 19, 2024

Developing your web extension with the best tools

Developing your web extension with the best tools

Link to EXTENTOOL

Eric Masseran

·

Follow

9 min read

·

Apr 18,

--

A list of the best tools I discovered while developing the Sync Tab Groups extension and how to use them. The tools simplify and improve my coding experience. The tools are compatible with both Firefox and Chrome.

Photo by &#;&#;&#; NG on Unsplash

Control the browser session

Motivation

The first thing to prepare is the browser environment. I don&#;t recommend to use your day to day session. When you develop, you do mistakes that could break the extension in your session or corrupt your data (bookmarks, open tabs&#;).

Create a tailor-made browser session

The best tool so far for the web extension ecosystem is called web-ext. It opens a browser with a temporary session and your extension already installed. The browser is configurable to open some pages on start and to change the settings. This tool accepts both a configuration file and line parameters.

An example of a web-ext configuration to store your browser environment as code

The change of the settings was very useful when the hidden tab API was still experimental in Firefox 59. The opened browser was compatible with the extension without any additional manual operation.

A useful page to open is the about:debugging page in order to have access to the extension options.

The extension options in &#;about:debugging&#; when developing

You can use the extension to open some extension URLs like the options or some test pages. If you are looking for a solution, you can read the &#;Automatically open the page&#; section from this previous blog post.

Chrome compatibility

I found no equivalent tool for Chrome. You have to use a manual method. You can change the session by using another &#;people&#;. The menu is at the top right of the Chrome browser window.

An issue has been open in the web-ext repository to add an option to open Chrome instead of Firefox. The feature is already in progress, we hope it is for soon.

Lint your extension

web-ext not only controls the browser session but also embeds a linter. The linter checks the compliance with the web extension standard. By using npx web-ext lint, you can know if your manifest respects the standards. If the extension doesn&#;t meet the standards, it is rejected by the browser store. In order to avoid back and forth with the store, the linter warns you about your problems. In my cases, it helped me a lot to anticipate errors in the manifest.json and in the JSON language files.

The web extension linter in action to respect the standards

The linter works only on the build version of the extension if you use Webpack. More especially, it only makes sense to lint the production version. The Webpack compilation often lets DANGEROUS_EVAL and UNSAFE_VAR_ASSIGNMENT. It is not a problem to use and release the extension with those warnings.

Translate your extension

The process to translate an extension and keeping the translation up to date could be tremendous. The translations are often not done by the developers and are not correlated with the release cycle. I developed a tool called Translate Web-Ext to simplify the process.

The 3 pillars are:

  • Setup easily: Fetch the language files over the internet
  • Stay focus: Get feedback about the translations to do
  • Start immediately: Translate everything from within the browser

Simple

The interface abstracts the JSON syntax. On top of that, Translate Web-Ext gives you feedback about the changes. The new or changed fields are highlighted. Also, the words that changed are colored.

Feedback examples for a new field and another one that changed

Once you are satisfied with a new translation you can mark it as done. In the end, you just have to download the JSON file with the translations inside. The downloaded file is ready to be consumed by the extension.

Setup

In order to work the translation app needs some previous JSON language files.

  • The original text to translate (mandatory)
  • The previous translation in order to not start from zero (optional)
  • The original text at the previous translation time to see the changes (optional)

For the extension developer side, in order to use Translate Web-Ext, you have only to make the JSON translation files available on the internet. It works like a charm with the repositories in Github.

The configuration section where you fetch the language file

Any doubt, click on this link to see the translation interface in action. It is the German translation process for an extension I am developing called Sync Tab Groups. The link sets in advance the language files to fetch, so your translators don&#;t bother with configuration. The base translation, the last one done, is at the tag v0.6 in GitHub. Whereas the targeting translation is the English one in the last release (master).

In the help section, you can find additional information on how to use Translate Web-Ext and an URL generator with the configured language files.

How to easily test a language setting

First, you should use the linter from web-ext to verify the file format is fine. Then, I prefer to use Chrome (or Chromium) to test the interface impact. The reason is that it is easier to change the language setting so that the extension is in another language.

By developing on Linux, I could change the language like this LANG=es chromium &. Alternative solutions are proposed in this StackOverflow thread if the previous solution doesn&#;t work. On Mac, the only solution that worked for me was to change the language in the OS settings.

Support both Chrome and Firefox

Same code for all your browser extensions

Web Extension Polyfill is a helpful library for Chrome. It creates a browser object bound to the chrome object. The goal is to write the extension only with the browser object. Then, it works on both the Firefox and Chrome browsers.

You might ask why it is useful as Firefox understands already the chrome object well. The reason is the browser object API uses Promises instead of callback. Although callback can do the job, Promises with async / await are pleasant to use.

API differences

Today, Firefox has many more features than Chrome (hidden tabs, open discarded tabs, set window/tab variables&#;). Check the Mozilla documentation to know which feature is available on which browser and since which version.

When I develop the extension Sync Tab Group, for targeting both browsers, I have 2 solutions:

  1. Share the same code and dynamically disable the missing feature at execution
  2. Limit the feature to the more restricted browser

As an example for the second point, I limited the commands (extension keyboard shortcuts) in the manifest to 4. It is the maximum value allowed in Chrome. Another example, on the client side this time. For my popup interface, I stopped using the menuitem API and switch to a homemade menu.

The homemade menu to work on both Firefox and Chrome

Behavior changes

Not only does the API differ but also the engine is different. Here, just a few hints on Chrome behaviors:

  • browser.tabs.remove could resolve the promise before the tab is really removed
  • Extension tabs are always closed on extension uninstallation/reload even if they don&#;t contain a call to the browser API
  • activated event is triggered before the close one for windows

Tests

Testing is a core strategy for keeping quality code and to be sure the application knowledge is hardcoded into the repository.

If you are familiar with test libraries like Jest or Jasmine, you can use them with the sinon package. The package mocks all the web extension API as none of the previous test frameworks understands this API.

Interface with the integration tests for a web extension

If you prefer to do real integration tests, you might embed a Jasmine test page into one of the web extension pages. Then you have access to the complete API and you can even bind the test page to the background script. If you are curious about all the best practices, you might enjoy this article about how to do integration tests with your web extension.

Build your extension

Description

Webpack is a most have to compile a complete JavaScript project. It manages for you the dependencies and transforms the code. It is usual to have at least 2 configurations: the development and production one. The development adds extra tooling and is more verbose whereas the production keeps only the essential and optimizes the code for speed against size and ease of reading.

The code transformations are interesting in:

  • The code to be compliant with older browser
  • Compiling the &#;client code&#; like the JSX format in React

Build the targets

A web extension is not always a single page app as there are at least a background script and an entry for each page (popup, side panel, tabs&#;). By default, Webpack builds a JavaScript file. If you want to template and bundle an HTML page, you should look at html-webpack-plugin.

Configure more than one entry with Webpack

In my extension I didn&#;t bundle directly HTML pages in order to control the CSS included and to import the webextension-polyfill library (the compiled version) before everything.

If you don&#;t include the polyfill library before any other code that calls the browser object, it crashes on Chrome. Another option is to import the browser object in each file (import browser from "webextension-polyfill"). Then Webpack adds and builds the necessary library.

Copy the static files

Many files are just assets for the extension, just copy them.

How to copy a bunch of assets with Webpack

Add your CSS

You could either import the CSS in the HTML pages like usually or you could import it directly in the JS code with import &#;../css/font-awesome.scss&#; . The drawback of the second method is that it duplicates the CSS in each JS target. In my project, I mostly used the first method for the CSS I wrote to avoid duplication and decrease the extension size. I only used the imported method for the Font Awesome library. Thus, I could add it as a dependency in the package.json and let Webpack building it for me.

For more information, please visit telescopic tools.

How to compile css/scss files including the Awesome Font library

Import compiled libraries from the node_modules

With Webpack and the plugin copy-webpack-plugin , you can even fetch the source from within the node_modules folder. Thus, you can have access to compiled libraries directly importable by your web extension.

How to fetch some files directly in the node_modules folder

Debug hints

Global variable with Webpack

You can access the extension from the console, however, when Webpack builds the extension you lose the references.

A solution is to attach the function in the source code to the window like this window.openTab = openTab;. The function is then available in the console!

Set an environment variable with Webpack

A global variable is especially useful for knowing if you are in development mode. You can change the extension behaviors and verbosity.

Define a variable for your project with Webpack

Debug from VS Code

By default, each browser offers a debug console where you can interact with the extension. However, if you want to be closer to the source code and you use VS Code, you can use a debugger extension.

Follow the documentation of the specific debugger to know how to get the debug port and how to connect to it.

It works with Firefox, however, it used to bug after a short utilization. I never tried for a few months, so the situation could be better.

Use the source map to debug with Webpack

In order to retrieve the original source code line from within a web extension built with Webpack, you have to set this in the Webpack configuration devtool: &#;inline-source-map&#;.

Even if it is not the best recommendation from the Webpack documentation, only the &#;inline&#; type works on Firefox. Else the source map file is not found in the packaged extension. Other source map configurations seem to work on Chrome.

For more information, check the Webpack issue or the web-ext issue.

Conclusion

I hope you enjoy the tools described in this article and that they help you to improve your coding experience. Not all of them might interest you now, just pick some and come back later if the need appears.

All the tools here are implemented in the extension Sync Tab Groups. I am still looking for contributors to help me developing the extension. :)

Hair Extension Tools Every Stylist Should Have In Their Kit

Rachel Koontz Hair Extensions | Styling | Tools
9 minute read

Every stylist knows the importance of efficiency and precision behind the chair; one key to this is having the right tools in your kit! This year, Donna Bella Hair is all about supporting stylists with innovative, reliable, revolutionary tools to simplify and speed up the art of installs, move-ups and removals. 

In this blog post, let&#;s explore our newest lineup of extension tools designed to streamline your processes, ensuring a faster, more seamless experience. These are must-haves for hairstylists looking to stay ahead of the game and elevate their business! Keep reading for everything you need to know about our three brand new tools and the five we updated. 

Thread Cutter 

Introducing our game-changing thread assistant tool&#; the Thread Cutter, a hairstylist's secret weapon for swift and precise Hybrid Weft extension removals. Have you heard of a seam ripper? A seam ripper works by carefully cutting and removing stitches in fabric, allowing for the precise and efficient removal of unwanted or incorrect sewing. Our new extensions tool has a very similar approach and is all about efficiency, boasting an ergonomic design with a comfort grip for those marathon move-up sessions. Crafted with a hardened steel cutter point, it effortlessly slices through thread, making the task of weft removal a walk in the park. Say hello to a world where removing extensions becomes as easy as a flick of the wrist! 

How to Use the Thread Cutter  

Ensure the sharp end faces the Hybrid Weft thread and use it to cut the thread with an upward motion. The small red ball provides an extra layer of safety between the cutter and the hair. 

The Rescue Tool 

Meet your new styling sidekick, the Rescue Tool! Designed for I-Link, Flat-Tip, and Hybrid Wefts, this tool turns bead removal into a breeze. It requires only a touch of pressure to remove over-clamped beads in a flash, The Rescue Tool opens and breaks beads with precision, rescuing you from any stubborn, crushed, warped, or compromised beads. This is definitely a hair extension tool many of us wish we&#;d had 20 years ago when we first started in extensions! 

How to Use The Rescue Tool 

Grab the tool by the handles, slide the pinchers into each end of the compromised bead, and break it open with a small movement.  

Hair Extension Tools to Update in Your Kit 

These are classic Donna Bella Hair extension tools that have been upgraded.  

Wider Swatches with the Updated Color Ring 

With 2.5" wide swatches featuring our full lineup of colors, this isn't just a hair extension tool; it's a marketing maven and conversation starter rolled into one. Display it proudly at your station, impressing clients with the array of possibilities extensions bring. From grays to balayage, ombre to solid shades, it's the stylist's secret weapon for showcasing the vibrant world of extensions. This hands-on experience not only guarantees precision but also invites clients into the exciting realm of choosing their ideal extension shade.  

The Old Version vs. The New 

What&#;s new about our Color Ring? It now features wider hair swatches so you can see the color blend more easily and really tell what the dimensional color looks like (which also makes for an easier sale with your client when they&#;re in the chair!). The new Color Ring also has every shade we offer, so you&#;ll be fully up to date on what shades are available from DBH. Of all the tools in your kit, this is one of the most important to keep updated!

How to Use the Color Ring 

Select one or several of our 40+ colors and hold a swatch against the ends of your client's hair to find the perfect match. Don&#;t forget, using more than one shade is always a great idea, to give more color dimension with your client's blend.

The New Strand Stand Organizer 

The new Strand Stand Organizer is a great tool for showcasing and organizing hair. Crafted from durable aluminum and plastic, this heat-resistant tool is not just stable but adjustable, offering three height settings to suit your styling needs. No more untangling chaos &#; the handy holder speeds up installations, keeps loose hair secure, and doubles as a conversation starter for potential extension enthusiasts.  

The Old Version vs. The New 

The older version of our Strand Stand was made with two separate parts, requiring bulkier packaging for every order. Now you don't have to order two tools, and it comes with a handy zippered carrying bag. We&#;ve also made the teeth at the top less sharp, so the tool is safer to use, and the base is sturdier and adjusts easier so you don&#;t get stuck wasting time setting up the tripod. Whether you're prepping for an installation or a move-up, the Strand Stand Organizer simplifies the process, and keeps your hair organized and easy to see.

How to Use the Strand Stand Organizer 

Adjust the tripod to your preferred height, ensuring a stable base. Attach the organizer tray, twist to tighten, and voila! Now you're ready to showcase hair in the top slots, making installations a breeze. When you're done using this tool, you can fold it down and use the zippered carrying case to make traveling with it easy.

The Multi Method Tool Has Replaced the Luxe Tool 

Meet the Multi Method Tool &#; use it to install and remove Flat-Tip, I-Link and Hybrid Weft beads and to remove Kera-Link extensions. Crafted from stainless steel with a padded grip, this ergonomic tool requires less gripping than before, so your hand won&#;t get tired. Plus, more precision means less hair snagging while you install or move-up. The two different ridges give you flexibility when breaking into keratin bonds for a smooth release and removal of the extensions. Similar to our older Luxe tool, but now with a smaller size and more comfortable ergonomic design, this is a go-to stylist tool designed to fast track your next appointment so you can wow your client. 

Of all our new tools, the Multi Method is one of the most functional for all of the different tasks it can help you with as a stylist.

How to Use the Multi Method Tool 

Grasp the padded handles for a comfortable hold that won't tire your hand. Use the curved tip to install and remove Flat-Tip, I-Link and Hybrid Weft beads. Use the pointed tip to clamp down on beads, whether you&#;re securing the hair during an install or opening the beads when removing hair. For Kera-Link removal, utilize the dual ridges which give you the flexibility to break apart bonds effortlessly. 

The New Melting Connector 

Introducing the Melting Connector &#; your new BFF for flawless Kera-Link (fusion) extensions! This precision tool is a game-changer with its smaller, more precise tip and adjustable heat settings. Because the handle isn&#;t as wide, it&#;s also easier to open and close so your hand won&#;t tire as easily. The improved temperature control and safer handle design make it a breeze to use, while the professional-length cord gives you all the flexibility you need.   

How to Use the Melting Connector  

Power it on, set your preferred temperature, and let the magic begin. Part off a clean subsection of natural hair, secure it with a Mini Clip, and align the extension bond for a perfect zero-degree elevation. In just 2-3 seconds, the melting connector works its magic, and you'll be rolling through each row with ease.  

Refill Sizes for Bond Removers 

Both our alcohol-based Bond Remover and oil-based Residue Remover just got a size upgrade, and these are a game-changer for Tape-Ins and Kera-Link (fusion) extensions. Stock up and save with the bigger bottle and enjoy the ease of use with this fast-dissolving and hair-friendly solution. Plus, we've given them a makeover &#; the removers are now clear instead of blue! 

How to Use the Bond Remover and Residue Remover

For Tape-In removal, apply Bond Remover first. Spray on a single weft and wait at least 10 seconds for the solution to absorb. Then gently massage at the top of the weft to loosen. If needed, add more remover; do not force a weft out. To remove, pull down (don&#;t peel from one side to another). For tricky wefts, use the second step of applying Residue Remover one weft at a time. Residue Remover is designed to get rid of any stubborn adhesive that&#;s left behind.

For Kera-Link bonds, first use the grooved part of the Multi Method Tool to clamp down on the keratin bonds. Break down each bond until you see a slight color change. Once the bond has been broken down, apply Bond Remover and wait at least 10 seconds. Using the grooved part of the Multi Method Tool, clamp the keratin bond again to further break it down. Gently pull the extension down in the direction of the natural hair, releasing the extension. 

For any residue that may be left in the client&#;s hair, use Residue Remover and gently comb out. If no residue is left behind, use a comb to brush out the row removing any natural shedding.  

If you&#;re planning to reinstall hair for a move-up, ensure that the client has fully clarified, clean, product-free, dry hair to avoid any buildup near the scalp. 

Conclusion 

A great install starts with great tools! We hope this blog post inspired you to upgrade your kit with a new hair extension tool or two... or even take your extension skills to the next level by learning a new method. We can&#;t wait to see the incredible transformations you create this year! 

Other Posts You Might Like 

Your Ultimate Guide to Buying Hair Extensions 

Stylists, Show Your Existing Color Clients the Power of Hair Extensions 

19

0

Comments

0/2000

All Comments (0)

Guest Posts

If you are interested in sending in a Guest Blogger Submission,welcome to write for us!

Your Name:(required)

Your Email:(required)

Subject:

Your Message:(required)

0/2000