1.0.3 • Published 5 years ago

external-downloader v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

external-downloader

webpack 3.0/4.0 plugin

  • Inlines the contents of '@import url("http://")' into the CSS.
  • Downloads the contents of the remote url() rules into the "tmp" folder and replaces the path to the new absolute location

Should be used before css-loader loader like so:

{
	test: /\.(scss|css)$/,
	use: extractSass.extract({
		use:[
			{
				loader:"css-loader",
				options: {
					minimize: true,
					importLoaders: 3,
					sourceMap: env.build != "production" ? true: false
				}
			},
			{
				loader: 'external-downloader'
			},
			{
				loader: 'postcss-loader',
				options: {
					plugins: [
						autoprefixer({

							browsers:['Android >= 4', 'iOS >=4']
						}),
						cssnano({})
					],
				}
			},
			{
				loader: 'sass-loader',
				options: {
					sourceMap: env.build != "production" ? true: false
				}
			},							
			
		]
	})
},

This

@import url('https://fonts.googleapis.com/css?family=Open+Sans');

Turns into this:

/* latin-ext */
@font-face {
	font-family: 'Open Sans';
	font-style: normal;
	font-weight: 400;
	src: local('Open Sans Regular'), local('OpenSans-Regular'), url([absolutepath]/mem8YaGs126MiZpBA-UFW50bbck.woff2) format('woff2');
	unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago