Spec-Zone.ru › Sass

LegacySyncImporter

LegacySyncImporter: ((this: LegacyImporterThis, url: string, prev: string) => LegacyImporterResult)

Type declaration

    • (this: LegacyImporterThis, url: string, prev: string): LegacyImporterResult
    • A synchronous callback that implements custom Sass loading logic for @import rules and @use rules. This can be passed to importer for either render or renderSync.

      See importer for more detailed documentation.

      sass.renderSync({
      file:"style.scss",
      importer: [
      function(url, prev) {
      if (url != "big-headers") returnnull;

      return {
      contents:'h1 { font-size: 40px; }'
      };
      }
      ]
      });

      Deprecated

      This only works with the legacy render and renderSync APIs. Use Importer with compile, compileString, compileAsync, and compileStringAsync instead.

      Parameters

      • this: LegacyImporterThis
      • url: string

        The @use or @import rule’s URL as a string, exactly as it appears in the stylesheet.

      • prev: string

        A string identifying the stylesheet that contained the @use or @import. This string’s format depends on how that stylesheet was loaded:

        • If the stylesheet was loaded from the filesystem, it’s the absolute path of its file.
        • If the stylesheet was loaded from an importer that returned its contents, it’s the URL of the @use or @import rule that loaded it.
        • If the stylesheet came from the data option, it’s the string "stdin".

      Returns LegacyImporterResult

  • Defined in js-api-doc/legacy/importer.d.ts:92
sass
  • Compile
    • AsyncCompiler
    • Compiler
    • CompileResult
    • compile
    • compileAsync
    • compileString
    • compileStringAsync
    • initAsyncCompiler
    • initCompiler
  • Options
    • Options
    • StringOptions
    • OutputStyle
    • StringOptionsWithImporter
    • StringOptionsWithoutImporter
    • Syntax
  • Logger
    • Logger
      • silent
    • Logger
    • SourceLocation
    • SourceSpan
    • LoggerWarnOptions
  • Importer
    • NodePackageImporter
    • FileImporter
    • Importer
    • ImporterResult
  • Custom Function
    • CalculationInterpolation
    • CalculationOperation
    • SassArgumentList
    • SassBoolean
    • SassCalculation
    • SassColor
    • SassFunction
    • SassList
    • SassMap
    • SassMixin
    • SassNumber
    • SassString
    • Value
    • CalculationOperator
    • CalculationValue
    • CustomFunction
    • ListSeparator
    • sassFalse
    • sassNull
    • sassTrue
  • Other
    • Exception
    • CanonicalizeContext
    • Deprecations
    • LegacyFileOptions
    • ChannelName
    • ChannelNameHsl
    • ChannelNameHwb
    • ChannelNameLab
    • ChannelNameLch
    • ChannelNameRgb
    • ChannelNameXyz
    • ColorSpaceHsl
    • ColorSpaceHwb
    • ColorSpaceLab
    • ColorSpaceLch
    • ColorSpaceRgb
    • ColorSpaceXyz
    • GamutMapMethod
    • HueInterpolationMethod
    • KnownColorSpace
    • PolarColorSpace
    • PromiseOr
    • RectangularColorSpace
    • info
  • Legacy
    • types
      • Boolean
      • Color
      • Error
      • List
      • Map
      • Null
      • Number
      • String
    • LegacyException
    • LegacyImporterThis
    • LegacyPluginThis
    • LegacyResult
    • LegacySharedOptions
    • LegacyStringOptions
    • LegacyAsyncFunction
    • LegacyAsyncFunctionDone
    • LegacyAsyncImporter
    • LegacyFunction
    • LegacyImporter
    • LegacyImporterResult
    • LegacyOptions
    • LegacySyncFunction
    • LegacySyncImporter
    • LegacyValue
    • FALSE
    • NULL
    • TRUE
    • render
    • renderSync
  • Messages
    • Version
    • Deprecation
    • DeprecationOrId
    • DeprecationStatus
    • deprecations

© 2006–2025 the Sass team, and numerous contributors
Licensed under the MIT License.
https://sass-lang.com/documentation/js-api/types/LegacySyncImporter

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API