importing style-sheet into app.scss to use throughout project - ionic-framework

I want to use a style page across my app.
in the app.scss file I tried using:
#import "../global-scss/html-table-styles.scss";
this does not work.
Pasting the style directly into the app.scss file does work but I would rather not do that.
Is what I'm trying to accomplish possible and if so, what am I doing wrong?

If your file structure is like this:
├── src
│   ├── app
│   │   ├── app.component.ts
│   │   ├── app.module.ts
│   │   ├── app.scss
│   │   └── main.ts
// ... pages, components ...
| └── theme
│   ├── custom-styles.scss
...the import line should be:
#import "../theme/custom-styles.scss";

The problem was due to my poor understanding of style-sheets and because there is an answer already so I am unable to delete.
In the style-sheet I was trying to import I had followed the pattern used for styles local to a page and had a base style tag
eg:
html-table-styles{
//my styles
}
when i imported #import "../global-scss/html-table-styles.scss"; the styles were not being used, removing html-table-styles solved my issue

Related

Pytest set default path/directory/fodler as project directory (solve FileNotFoundError)

I have the next tree:
root_project/
├── app
│   ├── default_photo_profile.jpg
│   ├── config.py
│   ├── __main__.py # My app are python package, I'm runnig it via "python -m"
│   └── ...
├── tests
│   ├── test_unit.py # import config.py inside
│   ├── functional # import config.py inside
│   ├── pytest.ini
│   └── ...
...
Currently default_photo_profile causing error because tests doesn't have this file.
Reading file in config.py:
DEFAULT_PHOTO_FILE_PATH = Path('default_photo.jpg')
with open(file=DEFAULT_PHOTO_FILE_PATH, mode='rb') as file_obj:
DEFAULT_PHOTO_BYTES = file_obj.read()
How I can solve this?
I tried:
Patch access to default_photo.jpg with fixture - not helped, error during import stage, not executiion.
set flag to pytest comamnd line: --rootdir app - not helped (don't know why).
try/except for reading the file in app.config.py - may help but it's not my intention, I really want raise error if file not found
Put default_photo.jpg inside EVERY test directory - will help bit dirty.
Patch os.path like suggested in https://stackoverflow.com/a/43003192/11277611 - dirty
Include tests into package (move __main__.py into root_project - not sure that it's a good idea (have not enough experience to decide).
Set absolut path to default_photo.jpg - will fail on the production server.
Probably adoptable solutions (What I want):
Set root dir to root_project.app somehow inside pytest.ini to immitate regular execution.
Set root dir to root_project.tests somehow to place file in root of tests and access from any of tests folder.
Try to use following code in config.py:
DEFAULT_PHOTO_FILE_PATH = Path(__file__).parent / 'default_photo.jpg'
with open(file=DEFAULT_PHOTO_FILE_PATH, mode='rb') as file_obj:
DEFAULT_PHOTO_BYTES = file_obj.read()
Is it what you are trying to achieve?

Links to json files

my directory structure is
├── xxx
│   ├── 01.md
| └── 02.md
├── auth
│   ├── j1.json
│   ├── j2.json
│   └── j3.json
└── default.template.html
And I link jsons from markdowns like Auth. It makes sense as we use there files as test scenarios and in json files we have credentials and roles. But if I try to generate html it fails on unresolved internal reference: ../auth/aspect_admin.json. I tried to exclude the link checking but without any help. The best would be to leave it as a link in md file but somehow follow the link and include the json as code block in generated html. Is it possible?
It was a bug and will be fixed in next version https://github.com/planet42/Laika/issues/148

Ckeditor 5 does not work when I add plugins (with no errors)

import InlineEditor from '#ckeditor/ckeditor5-build-inline';
// import Bold from '#ckeditor/ckeditor5-basic-styles/src/bold';
InlineEditor
.create( document.querySelector( '#editor' ), {
// plugins: [ Bold ],
toolbar: [ 'bold' ]
} )
.then((editor) => {
editor.setData('Some Text');
})
.catch( error => {
console.error( error );
} );
When I enable plugins:
import InlineEditor from '#ckeditor/ckeditor5-build-inline';
import Bold from '#ckeditor/ckeditor5-basic-styles/src/bold';
InlineEditor
.create( document.querySelector( '#editor' ), {
plugins: [ Bold ],
toolbar: [ 'bold' ]
} )
.then((editor) => {
editor.setData('Some Text');
})
.catch( error => {
console.error( error );
} );
My npm packages
webpack-demo#1.0.0 /var/www/english.dev.*******/frontend/web/js/npm/webpack-demo
├── #ckeditor/ckeditor5-autoformat#1.0.0-alpha.2
├── #ckeditor/ckeditor5-basic-styles#1.0.0-alpha.2
├── #ckeditor/ckeditor5-build-inline#1.0.0-alpha.2
├── #ckeditor/ckeditor5-core#1.0.0-alpha.2
├── #ckeditor/ckeditor5-editor-classic#1.0.0-alpha.2
├── #ckeditor/ckeditor5-engine#1.0.0-alpha.2
├── #ckeditor/ckeditor5-essentials#1.0.0-alpha.2
├── #ckeditor/ckeditor5-image#1.0.0-alpha.2
├── #ckeditor/ckeditor5-markdown-gfm#1.0.0-alpha.2
├── #ckeditor/ckeditor5-paragraph#1.0.0-alpha.2
├── #ckeditor/ckeditor5-ui#1.0.0-alpha.2
├── #ckeditor/ckeditor5-utils#1.0.0-alpha.2
├── babel-cli#6.26.0
├── babel-core#6.26.0
├── babel-loader#7.1.2
├── babel-plugin-transform-class-properties#6.24.1
├── babel-plugin-transform-decorators-legacy#1.3.4
├── babel-preset-env#1.6.1
├── babel-preset-react#6.24.1
├── compression-webpack-plugin#1.1.2
├── css-loader#0.28.7
├── fade-props#2.1.0
├── gzip-loader#0.0.1
├── jquery#3.2.1
├── lodash#4.17.4
├── mobx#3.4.1
├── mobx-react#4.3.5
├── node-sass#4.7.2
├── raw-loader#0.5.1
├── react#15.6.2
├── react-addons-css-transition-group#15.6.2
├── react-addons-update#15.6.2
├── react-css-transition-replace#3.0.2
├── react-dom#15.6.2
├── react-redux#5.0.6
├── react-router#4.2.0
├── react-router-dom#4.2.2
├── redux#3.7.2
├── redux-devtools#3.4.1
├── sass-loader#6.0.6
├── style-loader#0.19.1
└── webpack#3.10.0
.html
<div id="editor"></div>
Actually my goal is to insert html with tag , via method setData(), but as I underdtood, I need to use plugin Markdown. But anyway I can't make it work with any plugins. Thank you.
P. S. I tried basic and inline forms but the same problem.
I found out that it was because there wasn't imported and used Paragraph
import Paragraph from '#ckeditor/ckeditor5-paragraph/src/paragraph';
....
plugins: [ Paragraph ]
.....
I think it's not good behavior for ckeditor. But it is 1.0.0 what do I want from it.. xD
CKEditor 5 is highly modular and even features such as support for typing are separate plugins which you need to load. An editor creator cannot assume which modules should be loaded and leaves all that to the developers.
You can read more about the architecture in "Architecture overview".
So, it's your obligation to load all necessary plugins when you're building the editor from source. If you use existing editor builds you don't have to do that because builds have a set of plugins built in.
BTW, loading Paragraph is not enough to create an editor. You won't be able to type or paste. Therefore, there's a plugin which enables all these essential features – Essentials.
Refer to the CKEditor 5 Framework's "Quick start" guide for more information (e.g. ready-to-use code snippets).

inheritance-diagrams in sphinx for matlab

I am documenting a matlab code that I have with sphinx. I am using the package sphinxcontrib-matlabdomain.
My directory tree is as follows:
me:~/.../doc$ tree ../
../
├── doc
│   ├── conf.py
│   ├── make.bat
│   ├── Makefile
│   ├── index.rst
│   ├── BaseClass.rst
│   └── DerivedClass.rst
├── LICENSE.md
├── README.md
└── src
├── BaseClass.m
└── DerivedClass.m
The problem comes when I want to show inheritance diagrams. I have added the necessary things in my config.py file:
matlab_src_dir = os.path.abspath('..')
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.graphviz',
'sphinx.ext.viewcode',
'sphinxcontrib.matlab',
]
primary_domain = 'mat'
And I have the following in the index.rst file
Welcome to BGK's documentation!
===============================
I am trying to have a diagram here...
.. inheritance-diagram:: BaseClass DerivedClass
:parts:2
.. graphviz::
digraph {
"From here" -> "To" -> "Somewhere";
"From here" -> "To" -> "Somewhere else";
}
And in the output the directive inheritance-diagram is ignored, obtaining directly the next diagram that I am using to test that I can plot diagrams.
Is there any incompatibility to plot inheritance diagrams with sphinx for matlab classes? Is there any way to go around the problem? Thanks!
Sphinx does not support this. The built-in sphinx.ext.inheritance_diagram extension is for the Python domain only. It does not work for Matlab. If it did, I'm sure it would say so in the Sphinx documentation (and a glance at the source code in sphinx/ext/inheritance_diagram.py confirms that it is only for Python).
The only way inheritance diagrams for Matlab could work is if some other extension provided the functionality. The sphinxcontrib-matlabdomain extension that you use does not.

Why is Compass is giving me an import error when trying to import partials

My compass project directory structure looks like this
s3z#s3z:~/Desktop/compass_project$ tree
.
├── basic.html
├── config.rb
├── css
│   ├── ie.css
│   ├── print.css
│   └── screen.css
├── index.html
├── partials
│   └── _normalize.scss
└── sass
├── ie.scss
├── print.scss
└── screen.scss
My screen.scss file looks like this
#import "compass";
#import "partials/normalize";
When I add #import "partials/normalize"; and save it, Compass spits the following error back at me
>>> Compass is watching for changes. Press Ctrl-C to Stop.
>>> Change detected at 22:58:53 to: screen.scss
error sass/screen.scss (Line 2: File to import not found or unreadable: partials/normalize.
Load paths:
/home/max/Desktop/nettut_compass_tut/sass
/home/max/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/blueprint/stylesheets
/home/max/.rvm/gems/ruby-1.9.3-p194/gems/compass-0.12.2/frameworks/compass/stylesheets
Compass::SpriteImporter)
overwrite ./css/screen.css
And just in case it matters my config.rb is
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
Any ideas on how to fix this?
You've defined your sass_dir as sass so compass is looking for that reset file in: sass/partials/normalize If you want to import something outside of your sass_dir, you need to use a path relative to the sass file that's doing the importing:
#import "../partials/normalize";
personally, I prefer to put the partial directory in the sass directory, or just let them sort to the top loose.