-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate Tailwind framework (#3999)
[Task link](https://www.pivotaltracker.com/story/show/183992025) This PR moves the documentation visualization into a separate crate and sets up the Tailwind CSS framework for this new crate. We would use Tailwind to style our HTML documentation. https://user-images.githubusercontent.com/6566674/208719213-85f78f7e-8dc2-45d5-95a1-db4baad1bda1.mp4
- Loading branch information
Showing
13 changed files
with
175 additions
and
7 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
[package] | ||
name = "ide-view-documentation" | ||
version = "0.1.0" | ||
authors = ["Enso Team <[email protected]>"] | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
enso-frp = { path = "../../../../lib/rust/frp" } | ||
enso-logger = { path = "../../../../lib/rust/logger" } | ||
enso-prelude = { path = "../../../../lib/rust/prelude" } | ||
ensogl = { path = "../../../../lib/rust/ensogl" } | ||
ensogl-component = { path = "../../../../lib/rust/ensogl/component" } | ||
ensogl-hardcoded-theme = { path = "../../../../lib/rust/ensogl/app/theme/hardcoded" } | ||
ide-view-graph-editor = { path = "../graph-editor" } | ||
wasm-bindgen = { workspace = true } | ||
serde_json = { version = "1.0" } | ||
|
||
[dependencies.web-sys] | ||
version = "0.3.4" | ||
features = [] | ||
|
||
[build-dependencies] | ||
ide-ci = { path = "../../../../build/ci_utils" } | ||
tokio = { workspace = true } |
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,2 @@ | ||
# Automatically generated | ||
stylesheet.css |
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 @@ | ||
/* | ||
In this file, one can define custom CSS rules for use in the documentation panel. | ||
The Tailwind CLI utility uses this file as an input file, and the content is copied to | ||
the final CSS stylesheet of the documentation panel. | ||
See the crate documentation to learn more. | ||
*/ | ||
|
||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
File renamed without changes.
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,37 @@ | ||
//! This script would run Tailwind CLI utility to generate a CSS stylesheet by scanning the | ||
//! source code for class names and including needed CSS rules in the output file. | ||
//! | ||
//! See crate documentation to learn more. | ||
use ide_ci::prelude::*; | ||
|
||
use ide_ci::programs::Npm; | ||
|
||
|
||
|
||
/// The path to the input file. One can define arbitrary CSS rules there and they will be copied | ||
/// in the output file. | ||
const CSS_INPUT_PATH: &str = "assets/input.css"; | ||
/// The filename of the resulting CSS stylesheet. It will be generated inside `OUT_DIR`. | ||
const CSS_OUTPUT_FILENAME: &str = "stylesheet.css"; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result { | ||
// We should rerun the tailwind on changes in our sources. | ||
// Tailwind scans this directory to determine the used classes. | ||
println!("cargo:rerun-if-changed=src"); | ||
// We should rerun the tailwind on changes in the input CSS file. | ||
// It may contain custom CSS rules. | ||
println!("cargo:rerun-if-changed={CSS_INPUT_PATH}"); | ||
|
||
install_and_run_tailwind().await?; | ||
Ok(()) | ||
} | ||
|
||
async fn install_and_run_tailwind() -> Result { | ||
Npm.cmd()?.install().run_ok().await?; | ||
let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap()).join(CSS_OUTPUT_FILENAME); | ||
let args: &[&str] = &["--", "-i", CSS_INPUT_PATH, "-o", out_path.as_str()]; | ||
Npm.cmd()?.run("generate", args).run_ok().await?; | ||
Ok(()) | ||
} |
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": "enso-tailwind-wrapper", | ||
"version": "1.0.0", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"tailwindcss": "^3.2.4" | ||
}, | ||
"scripts": { | ||
"generate": "tailwindcss" | ||
} | ||
} |
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,8 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['src/**/*.rs'], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} |
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