Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #474 Add resolve options for imports from css files. (David E…
…llingsworth, weaverryan) This PR was merged into the master branch. Discussion ---------- Add resolve options for imports from css files. These options change the default resolver functionality when import is used in css files. This reduces the burden on the developer to locate styles provided by npm packages. E.g. With these changes the follow become valid: sass-test.scss: ```css // Resolution via "sass" property in package.json file in npm package @import '~bootstrap'; // Resolution via file extension to css-test.css @import 'css-test'; ``` css-test.css ```css // Resolution via "style" property in package.json file in npm package @import '~@fortawesome/fontawesome-free'; ``` Commits ------- 7895f63 fixing CS 9525e7a Merge branch 'master' into resolve 382bc5f Add functional test for css imports via package.json style property b9e42be Add functional test for sass imports via package.json sass property 0f9657f Specify resolve option to be used with the css-loader. This allows @import in css files to locate a file to import based on the package.json file and to look for local files with the appropriate extensions when not specified. b54ec7b Specify resolve option to be used with the sass-loader. This allows @import in sass files to locate a file to import based on the package.json file and to look for local files with the appropriate extentions when not specified.
- Loading branch information
Showing
8 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// There seems to be an issue with the sass-loader and prefixing | ||
// aliased directories with a tilde. The following line is how | ||
// this import should look and works for node_modules. | ||
// @import '~lib/test-pkg'; | ||
|
||
// Importing without the tilde seems to work for webpack aliases | ||
@import 'lib/test-pkg'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '~lib/test-pkg'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$content:'Sass entrypoint'; | ||
|
||
body { | ||
content:$content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
content:'Style entrypoint'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use strict"; | ||
|
||
document.write("JavaScript entrypoint"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name":"@symfony/webpack-encore-test-pkg", | ||
"description": "This is a test package for use by functional tests which use packages.", | ||
"author": { | ||
"name": "David Ellingsworth", | ||
"email": "david@desource.org" | ||
}, | ||
"main":"js/javascript_entry.js", | ||
"style":"css/style_entry.css", | ||
"sass":"css/sass_entry.scss" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters