Elm The Html.Attributes module does not expose css - elm

Elm cannot find css for some reason
import Html.Attributes exposing (class, css)
elm.json:
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"matheus23/elm-default-tailwind-modules": "2.0.3",
"rtfeldman/elm-css": "17.0.5"
},
"indirect": {
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2",
"robinheghan/murmur3": "1.0.0",
"rtfeldman/elm-hex": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

css isn't part of the core Elm Html.Attribute module, it's part of elm-css (which I see you've included in your elm.json), which introduces the Html.Styled, Html.Styled.Attributes, Html.Styled.Events modules that are basically drop-in replacements for their non-Styled counterparts, but with css support.
So just change:
import Html.Attributes exposing (class, css)
To:
import Html.Styled.Attributes exposing (class, css)
And you should be good.
For details, see their docs - https://package.elm-lang.org/packages/rtfeldman/elm-css/17.0.5/

Related

Webdriver io autocomplete in VS Code

I'm using Webdriver IO as the e2e testing framework. But this autocomplete issue is really slowing me down. VS Code doesn't auto complete the global variable browser and it's methods.
.eslintrc
{
"extends": ["eslint:recommended", "standard"],
"parser": "babel-eslint",
"plugins": [
"mocha",
"webdriverio"
],
"env": {
"webdriverio/wdio": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"rules": {
"indent": ["error", 4]
}
}
.babelrc
{
"presets": ["es2015"],
"plugins": [
["transform-runtime", {
"polyfill": false
}]
]
}
I think you can use TypeScript typings.
Add 2 dependencies to package.json:
"#types/node": "^8.5.2",
"#types/webdriverio": "^4.8.7",
Install them, reload project. If autocomplete does not yet works, create
tsconfig.json in root of your project:
{
"compilerOptions": {
"allowJs": true,
"outDir": "./.built/"
}
}
You don't need to use typescript compiler, it will just provide autocomplete. Continue writing your js code as usual.
But if you wish to use typescript, here is small beginner guide:
http://webdriver.io/guide/getstarted/configuration.html#Setup-TypeScript

Ngx\clipboard Not working with Aot and Rollup

I have tried to implement aot in my app but While building my app with aot and rollup gets this error.I have used ngx-clipboard.
'ngx-clipboard/src/index' is imported by
wwwroot\app\aot\app\app.module.ngfactory.js, but could not be resolved ΓÇô
treating it as an external dependency
'ngx-clipboard/src/window.service' is
imported by wwwroot\app\aot\app\app.module.ngfactory.js, but could not be
resolved ΓÇô treating it as an external dependency
'ngx-clipboard/src/clipboard.directive' is imported by
wwwroot\app\aot\app\patients\patient-result\patient-
result.component.ngfactory.js, but could not be resolved ΓÇô treating it as
an external dependency
'ngx-clipboard/src/clipboard.service' is
imported by wwwroot\app\aot\app\patients\patient-result\patient-
result.component.ngfactory.js, but could not be resolved ΓÇô treating it a
s an external dependency
'ngx-clipboard/src/document.service' is imported by
wwwroot\app\aot\app\app.module.ngfactory.js, but could not be resolved ΓÇô
treating it as an external dependency
'ngx-clipboard/src/clipboard.service' is imported
by wwwroot\app\aot\app\app.module.ngfactory.js, but could not be resolved
ΓÇô treating it as an external dependency
No name was provided for external module 'ngx-clipboard/src/index' in
options.globals ΓÇô guessing 'import10'
No name was provided for external module 'ngx-clipboard/src/window.service'
in options.globals ΓÇô guessing 'import13'
No name was provided for external module 'ngx-
clipboard/src/clipboard.directive' in options.globals ΓÇô guessing
'import5'
No name was provided for external module 'ngx-
clipboard/src/clipboard.service' in options.globals ΓÇô guessing 'import28'
No name was provided for external module 'ngx-
clipboard/src/document.service' in options.globals ΓÇô guessing 'import27'
Here is my package.json
{
"name": "demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"aot": "node_modules/.bin/ngc -p wwwroot/tsconfig-aot.json",
"rollup": "node_modules/.bin/rollup -c wwwroot/rollup-config.js",
"cleanup": "rimraf wwwroot/app/aot && rimraf wwwroot/build.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"angular/animations": "4.1.3",
"angular/common": "4.1.3",
"angular/compiler": "4.1.3",
"angular/compiler-cli": "4.1.3",
"angular/core": "4.1.3",
"angular/forms": "4.1.3",
"angular/http": "4.1.3",
"angular/material": "2.0.0-beta.6",
"angular/platform-browser": "4.1.3",
"angular/platform-browser-dynamic": "4.1.3",
"angular/platform-server": "4.1.3",
"angular/router": "4.1.3",
"angular/upgrade": "4.1.3",
"core-js": "2.4.1",
"ngx-clipboard": "8.0.3",
"rxjs": "5.4.0",
"systemjs": "0.20.13",
"zone.js": "0.8.11"
},
"devDependencies": {
"ngx-window-token": "0.0.2"
"rollup": "0.43.0",
"rollup-plugin-commonjs": "8.0.2",
"rollup-plugin-node-resolve": "3.0.0",
"rollup-plugin-uglify": "2.0.1",
"typescript": "2.2.2",
"rimraf": "2.6.1"
}
}
Here is my tsconfig-aot.json
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"app/app.module.ts",
"app/main-aot.ts"
],
"angularCompilerOptions": {
"genDir": "app/aot",
"skipMetadataEmit": true
}
}
Here is my rollup.config.js
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
export default {
entry: 'wwwroot/app/main-aot.js',
dest: 'wwwroot/build.js', // output a single application bundle
sourceMap: false,
format: 'iife',
onwarn: function (warning) {
// Skip certain warnings
// should intercept ... but doesn't in some rollup versions
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
// console.warn everything else
console.warn(warning.message);
},
plugins: [
nodeResolve({ jsnext: true, module: true }),
commonjs({
include: 'node_modules/**',
}),
uglify()
]
}
Thanks in advance
Try this:
In rollup-config.js import alias
import alias from 'rollup-plugin-alias';
Under plugins add
'ngx-clipboard': __dirname + '/node_modules/ngx-clipboard/dist/',
'ngx-window-token': __dirname + '/node_modules/ngx-window-token/dist/'

ASP.NET Core project cannot find class/method in its referenced project

as a beginner I tried to follow right way to create a class library project or ASP.Net core webApi. The situation of mine is:
1) I created a class library project (let's call it 'AAA') using .net Core. The framework for a class library should be "netstandard1.6" I know. I defined 1 static class and its methods.
2) Then I create another Asp.Net Core WebApi project, and let's call it 'BBB' The default framework in project.json file is "netcoreapp1.0" then.
Then in project BBB -- 'References' I add project AAA as reference. No error happens. However if I try to use the static class/method defined in prject AAA, Visual studio told me that static class could not be found. (Instead of traditional .Net project it will auto-pop suggestion and if I click the link, VS automatically add code and sort it out for me.)
But if I move mouse on top of the red error part, VS (or re-sharper) did suggest like "Reference prject AAA... NETStandard, Version=v1.6' and use project AAA.static class/method....". However even if I click on the suggestion, there is still NO changes at all.
How come for that and how could I fix it?
Thanks a lot!!
The .NET Standard library framework is used by the .NET Core class library, but not by your .NET Core application.
So your class library has a project.json like this :
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}
And to reference this class library into a .NET Core application, you have to add the depencency, with the default imports and it will work :
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"ClassLibrary1": "1.0.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
With this both project.json files, the reference is great and if I add a static class in my class library like :
public static class Class2
{
public static void Test()
{
}
}
I can call this method in a web app controller, like :
[HttpGet]
public void TestStaticCall()
{
ClassLibrary1.Class2.Test();
}
I finally solved this from this post: https://github.com/aspnet/Tooling/issues/664. Update Resharper did help! Thanks a lot every one!!

EF 7 .NET Core tools error

I have created a new .NET Core project with dotnet new -t lib command. It's a class library for my EF Context. This is my project.json:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {},
"frameworks": {
"netstandard1.6": {
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
}
}
}
}
When I run dotnet restore command I'm getting this error:
error: Package Microsoft.EntityFrameworkCore.Tools 1.0.0-preview2-final is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package Microsoft.EntityFrameworkCore.Tools 1.0.0-preview2-final supports:
How I can use EF Code First with netstandard1.6?
According to this, The "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final" should be registered in a tools section in project.json:
{
"version": "1.0.0-*",
"description": "Class Library",
"frameworks": {
"netstandard1.6": {
"imports": [
"dnxcore50"
]
}
},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.EntityFrameworkCore": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
}
}
Also it is a good idea to use imports, because some of the EF Core’s dependencies still don't support .NETStandard, but in your case I checked and it works even without imports.
Regarding the Johan B's comment, which states ef tools cannot be used with class libraries for now, it is partly addressed by using --startup-project workaround, for example: dotnet ef --startup-project ../ProjectThatCanRunCommand/ migrations add InitDb, more info: Parameterize directories used by dotnet-ef.

Portable app not working when netcoreapp1.0 section moved to frameworks

I'm using ASP.NET Core 1.0 with preview 2 tooling.
I moved the netcoreapp1.0 section from dependencies to netcoreapp1.0 in frameworks like so:
"frameworks": {
"netcoreapp1.0": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
}
}
Now when I deploy the app, it complains about there is no runtimes section specifying an RID. And when I add that it is deployed as a self-contained app.
Is this a bug?
The project.json should look like this (notice the dependencies property):
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
Because your reference to Microsoft.NETCore.App was not inside dependencies it could not be found and your application was treated as a standalone app.