
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@css-blocks/eyeglass
Advanced tools
Tool to provide easy interoperation with the Eyeglass SASS module manager
This package provides an easy way to integrate your CSS Blocks code with the Sass module manager Eyeglass.
npm install @css-blocks/eyeglass
Here's an example css-blocks.config.js
file using this package.
import sass from "node-sass";
import eyeglass from "eyeglass";
import { adaptor, adaptorSync } from "@css-blocks/eyeglass";
const sassOptions = {
outputStyle: "expanded"
};
const scss = adaptor(sass, eyeglass, sassOptions);
const scssSync = adaptorSync(sass, eyeglass, sassOptions);
module.exports = {
preprocessors: { scss }
preprocessorsSync: { scss: scssSync }
};
If your library provides CSS Block files that are written with Sass it will require the application that uses your library to include Sass preprocessing in its configuration.
In turn, so the library can maintain control over the preprocessing configuration that is used we recommend that your library ship an "optional adaptor" that looks like this:
import { DirectoryScopedPreprocessor } from "@css-blocks/eyeglass";
// a path to where your block files live
const PACKAGE_DIR = path.resolve(__dirname, "..", "..") + "/";
class MyModulesPreprocessor extends DirectoryScopedPreprocessor {
setupOptions(options: EyeglassOptions): EyeglassOptions {
// Don't manipulate the options passed in.
return Object.assign({}, options, {precision: 20});
}
}
export const adaptor = new MyModulesPreprocessor(PACKAGE_DIR);
If your application consumes CSS Block files that are written with Sass you'll need to work with any adaptors provided by the extensions you're using. This css-blocks/eyeglass integration provides a helper function that will select the correct processor for the block file being processed or fall back to a default sass processor.
This css-blocks configuration file is an example of how to consume the eyeglass adaptors from other libraries that use this integration.
// css-blocks.config.js
const sass = require("node-sass");
const Eyeglass = require("eyeglass");
import { adaptAll, adaptAllSync } from "@css-blocks/eyeglass";
// See the documentation for your module to know how to import
// its adaptors.
import { adaptor as fancyAdaptor } from "fancy-module";
import { adaptor as anotherAdaptor } from "another-package";
const sassOptions = {
// The default sass and eyeglass options for your application.
// Where important, these options might be overridden by the module itself.
};
const sassOptionsSync = Object.assign({}, sassOptions, {
// if necessary use different options for synchronous compilation (e.g. synchronous versions of JS functions)
});
// While it's probably irrelevant, the order of the adaptors here
// does matter, the first one that wants to process a file will win.
const eyeglassAdaptors = [
fancyAdaptor,
anotherAdaptor,
];
export default {
preprocesors: {
scss: adaptAll(eyeglassAdaptors, sass, eyeglass, sassOptions),
}
preprocesorsSync: {
scss: adaptAllSync(eyeglassAdaptors, sass, eyeglass, sassOptionsSync),
}
};
FAQs
Tool to provide easy interoperation with the Eyeglass SASS module manager
We found that @css-blocks/eyeglass demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.