Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Linaria works with svg urls #1388

Merged
merged 1 commit into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/linaria/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { css } from '@linaria/core';
import { styled } from '@linaria/react';

import MenuItem from 'MenuItem';
import Media from 'Media';

import AngleDownUrl from './angle-down-solid.svg';

// Linaria seems very particular about what exactly you can interpolate
const media = {
Expand Down Expand Up @@ -74,6 +77,11 @@ const App = () => (
<Text>hello world!</Text>
<MenuItem>hi</MenuItem>
</Container>
<div>
<img src={AngleDownUrl} style={{ width: '1em' }} />{' '}
{/*<AngleDown style={{ width: '1em' }} />*/}
</div>
<Media />
</>
);

Expand Down
18 changes: 18 additions & 0 deletions examples/linaria/src/Media.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { styled } from '@linaria/react';

const SvgContainer = styled.div`
width: 32px;
height: 32px;
background: url('angle-down-solid.svg');
`;

export default function Media() {
return (
<div>
<h3>
Hello World <a href="https://true.io">True IO</a>
</h3>
<SvgContainer>Hi</SvgContainer>
</div>
);
}
3 changes: 3 additions & 0 deletions examples/linaria/src/angle-down-solid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/webpack-config-anansi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"dependencies": {
"@babel/runtime": "^7.17.2",
"@linaria/webpack5-loader": "^3.0.0-beta.17",
"@ntucker/linaria-webpack5-loader": "3.0.0-beta.17",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.4",
"@svgr/webpack": "^6.2.1",
"@types/webpack-bundle-analyzer": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-config-anansi/src/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function makeBaseConfig({
}
extraJsLoaders = [
{
loader: require.resolve('@linaria/webpack5-loader'),
loader: require.resolve('@ntucker/linaria-webpack5-loader'),
options: linariaOptions,
},
...extraJsLoaders,
Expand Down
51 changes: 39 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2574,17 +2574,6 @@
resolved "https://registry.yarnpkg.com/@linaria/utils/-/utils-3.0.0-beta.15.tgz#001d8dacf113c443960651593144e64bf39e995a"
integrity sha512-CF0T8ueWjHK8zJT0oqdAq8JgL9a40WCyE5/t6q8WPvC7xRdsrfyUKA7Z8qEsQse2LKESVWJ5cvkkn8J80B6c+A==

"@linaria/webpack5-loader@^3.0.0-beta.17":
version "3.0.0-beta.17"
resolved "https://registry.yarnpkg.com/@linaria/webpack5-loader/-/webpack5-loader-3.0.0-beta.17.tgz#f8c755fa0033d9e74395f228a25bfa59fb2e12ec"
integrity sha512-Th5yIqvxzFJ1NGk3qR2k9fti2erNopypItA4b6A8loyhgH1aYKOPyEvCIJh6Wo2MBouz4zWeNRTQT6NfI36uTA==
dependencies:
"@linaria/babel-preset" "^3.0.0-beta.17"
"@linaria/logger" "^3.0.0-beta.15"
enhanced-resolve "^5.3.1"
loader-utils "^2.0.0"
mkdirp "^0.5.1"

"@mdx-js/loader@^1.6.22":
version "1.6.22"
resolved "https://registry.yarnpkg.com/@mdx-js/loader/-/loader-1.6.22.tgz#d9e8fe7f8185ff13c9c8639c048b123e30d322c4"
Expand Down Expand Up @@ -2812,6 +2801,20 @@
node-gyp "^8.2.0"
read-package-json-fast "^2.0.1"

"@ntucker/linaria-webpack5-loader@3.0.0-beta.17":
version "3.0.0-beta.17"
resolved "https://registry.yarnpkg.com/@ntucker/linaria-webpack5-loader/-/linaria-webpack5-loader-3.0.0-beta.17.tgz#854dd54c39e967c838dd7943eddb42405ed81434"
integrity sha512-ByaXr/9dTASmMAaOCb0TRW4Z2i9+7OkoXAQOm60zhdfMOrYZZjNA+Ex/OnOABpaOc0qVx9UzbitAOUXbBurIxw==
dependencies:
"@linaria/babel-preset" "^3.0.0-beta.17"
"@linaria/logger" "^3.0.0-beta.15"
cosmiconfig "^5.1.0"
enhanced-resolve "^5.3.1"
find-yarn-workspace-root "^1.2.1"
loader-utils "^2.0.0"
mkdirp "^0.5.1"
normalize-path "^3.0.0"

"@octokit/auth-token@^2.4.4":
version "2.4.5"
resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.5.tgz#568ccfb8cb46f36441fac094ce34f7a875b197f3"
Expand Down Expand Up @@ -9651,6 +9654,14 @@ find-yarn-workspace-root2@1.2.16:
micromatch "^4.0.2"
pkg-dir "^4.2.0"

find-yarn-workspace-root@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-1.2.1.tgz#40eb8e6e7c2502ddfaa2577c176f221422f860db"
integrity sha512-dVtfb0WuQG+8Ag2uWkbG79hOUzEsRrhBzgfn86g2sJPkzmcpGdghbNTfUKGTxymFrY/tLIodDzLoW9nOJ4FY8Q==
dependencies:
fs-extra "^4.0.3"
micromatch "^3.1.4"

first-chunk-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70"
Expand Down Expand Up @@ -9822,6 +9833,15 @@ fs-extra@^10.0.0:
jsonfile "^6.0.1"
universalify "^2.0.0"

fs-extra@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94"
integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^9.0.0, fs-extra@^9.0.1, fs-extra@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
Expand Down Expand Up @@ -12667,6 +12687,13 @@ jsonfile@^2.1.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
optionalDependencies:
graceful-fs "^4.1.6"

jsonfile@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179"
Expand Down Expand Up @@ -19877,7 +19904,7 @@ universal-user-agent@^6.0.0:
resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee"
integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==

universalify@^0.1.2:
universalify@^0.1.0, universalify@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
Expand Down