-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Allow referencing assets from the root of the project. #707
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,15 @@ | ||
component Main { | ||
fun render : String { | ||
@asset(/fixtures/icon.svg) | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
---=== /__mint__/index.js ===--- | ||
export const A = () => { | ||
return `/__mint__/icon_c97b81630bc53286dadc8996727d348e.svg` | ||
}; | ||
|
||
---=== /__mint__/icon_c97b81630bc53286dadc8996727d348e.svg ===--- | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> | ||
<path d="M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z"/> | ||
</svg> |
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,67 @@ | ||
component Main { | ||
fun render : Html { | ||
@highlight-file(/fixtures/Test.mint) | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
import { | ||
createElement as A, | ||
fragment as B | ||
} from "./runtime.js"; | ||
|
||
export const C = () => { | ||
return A(B, {}, [ | ||
A("span", { | ||
className: "line" | ||
}, [ | ||
A("span", { | ||
className: "keyword" | ||
}, [`component`]), | ||
` `, | ||
A("span", { | ||
className: "type" | ||
}, [`Main`]), | ||
` { | ||
` | ||
]), | ||
A("span", { | ||
className: "line" | ||
}, [ | ||
` `, | ||
A("span", { | ||
className: "keyword" | ||
}, [`fun`]), | ||
` render : `, | ||
A("span", { | ||
className: "type" | ||
}, [`Html`]), | ||
` { | ||
` | ||
]), | ||
A("span", { | ||
className: "line" | ||
}, [ | ||
` <`, | ||
A("span", { | ||
className: "namespace" | ||
}, [`div`]), | ||
`></`, | ||
A("span", { | ||
className: "namespace" | ||
}, [`div`]), | ||
`> | ||
` | ||
]), | ||
A("span", { | ||
className: "line" | ||
}, [` } | ||
`]), | ||
A("span", { | ||
className: "line" | ||
}, [`} | ||
`]), | ||
A("span", { | ||
className: "line" | ||
}, [``]) | ||
]) | ||
}; |
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,10 @@ | ||
component Main { | ||
fun render : String { | ||
@inline(/fixtures/data.txt) | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
export const A = () => { | ||
return `Hello World! | ||
` | ||
}; |
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,20 @@ | ||
component Main { | ||
fun render : Html { | ||
@svg(/fixtures/icon.svg) | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
import { createElement as A } from "./runtime.js"; | ||
|
||
export const | ||
a = A(`svg`, { | ||
dangerouslySetInnerHTML: { | ||
__html: `<path d="M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z"/>` | ||
}, | ||
viewBox: `0 0 24 24`, | ||
height: `24`, | ||
width: `24` | ||
}), | ||
B = () => { | ||
return a | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "ROOT FOR TESTS" | ||
} |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require "spec" | ||
|
||
ENV["SPEC"] = "TRUE" | ||
MINT_ENV["TEST"] = "TRUE" | ||
|
||
require "./spec_helpers" | ||
|
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of chopping off the
./spec
from the filepath?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File.dirname(__FILE__)
is thespec
directory, so we need to remove that from the test file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what's wrong with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would not find the assets defined in specs.
/path/to/spec/.spec/test-file
where/path/to/spec/.spec
is not a file or a directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't because you've added a
mint.json
file to thespec/
folder?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the spec folder becomes the root folder
/
for the tests. So for example/fixtures/data.txt
is reachable so as../../fixtures/data.txt
fromspec/compilers/directives/inline
test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And why don't you reference the files from the root folder instead? Unless I'm mistaken this way it wouldn't need any hacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow. We would still need to chop
./spec
off. It doesn't matter if it's absolute or relative. And we still need to find the closestmint.json
to figure out the root folder.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I don't fully grok the situation. I'm gonna approve it and come back to it later, once I familiarize myself with the recent changes - and there's a lot of 'em 😅