当前位置: 首页 > 软件库 > 手机/移动开发 > >

nativescript-dev-sass

SASS CSS pre-processor for NativeScript projects
授权协议 Apache-2.0 License
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 郑星雨
操作系统 iOS
开源组织
适用人群 未知
 软件概览

SASS CSS pre-processor for NativeScript projects

nativescript-dev-sass is deprecated in favour of bundle workflow, which will be introduced with CLI v6.0. More info about the upcoming new approach can be found here.

This plugin uses the node-sass compiler to transpile SCSS files to CSS files in NativeScript projects.

Installation

Add the plug-in to your project:

$ tns install sass

Alternatively:

$ npm install nativescript-dev-sass --save-dev

Either of the above commands installs this module and installs the necessary NativeScript build and LiveSync hooks. SASS CSS pre-processing of all .scss or .sass files inside the app folder happens when the project is prepared for build (including LiveSync, Emulate and Watch commands).

After the plugin runs, it will automatically delete all .scss and .sass files from the app package (leaving only the compiled .css)

Configuration

No additional configuration required!

Usage

The best way to explore the usage of the plugin is to inspect the demo apps in the plugin's root folder.In demo folder you can find the usage of the plugin for JavaScript application. In demo-angular folder you can find the usage in an Angular application.

LiveSync Support

This plugin will work in all versions of NativeScript to transpile SCSS and SASS files, but for LiveSync to work as expected with real-time style updates:

  • NativeScript 2.5 and higher, use version 1.x and higher of this plugin (latest version)
  • NativeScript 2.4.x and lower, use version 0.4.2

You can install a specific version of this plug-in using this command:

$ npm install nativescript-dev-sass@0.4.2 --save-dev

To use the latest release candidates (when available), use this command:

$ npm install nativescript-dev-sass@rc --save-dev

In NativeScript 2.4 and lower, the current version of this plug-in will cause LiveSync to trigger an app restart. The last version of this plug-in that supports real-time updates (with no app restart) in NativeScript 2.4 and lower is 0.4.2.

Breaking Changes

v1.0.0

  • @import statements require relative paths (previous versions built all paths relative app root)
  • Importing stylesheets from node_modules now requires "~" to start the path (ex: @import '~nativescript-theme-core' instead of @import 'nativescript-theme-core')

SASS @import syntax

To import external stylesheets, use the standard SASS syntax:

@import 'variables'

As of v1.0.0 of this plug-in, imports use relative paths. For example, to reference an external stylesheet in the root app directory from a stylesheet in a sub-folder:

@import '../variables'

OR

@import '~/variables' // Supported in v1.1.0+

As of v1.0.0 of this plugin, you can also reference SASS files in the node_modules directory using the tilde (~) notation. For example, to reference a SASS stylesheet in the nativescript-theme-core plugin:

@import '~nativescript-theme-core/scss/platforms/index.ios'

NOTE: Do not include a forward slash after the tilde. Use ~[node_modules folder name] and not ~/[node_modules folder name]. The later will not resolve correctly.

Using file extensions with @import

In some cases, the current version of node-sass requires @import statements to explicitly include the filename extension (like .scss). This occurs if files with the same name exist in the same path.

For example:

variables.scss
variables.css
_variables.scss

Node-sass will throw an error if the @import 'variables'; syntax is used. As a workaround, use an explicit filename, like: @import 'variables.scss';

This is currently on the roadmap for node-sass 4.0. See this issue for more detail.

Contribute

We love PRs! Check out the contributing guidelines. If you want to contribute, but you are not sure where to start - look for issues labeled help wanted.

Get Help

Please, use github issues strictly for reporting bugs or requesting features. For general questions and support, check out Stack Overflow or ask our experts in NativeScript community Slack channel.

  • $ cnpm install node-sass --save-dev √ Installed 1 packages √ Linked 18 latest versions node-sass build Binary found at D:\n8\nweb\node_modules\_node-sass@4.5.3@node-sass\vendor\win32-x64-48\binding.no

  • 本文来自pilishen.com---- 原文链接; 欢迎作客我们的php&Laravel学习群:109256050 《Npm Debug Series》是我们课程laravel实战实战系列课程的扩展阅读篇,虽然视频中我们已经将npm install过程中的常见问题及解决方案都说了,但是鉴于npm的问题相对频繁,有随时查阅之需,故有此系列文章。 最近很多小伙伴在使用最新的laravel5.4来学习

  • 本文来自pilishen.com----原文链接; 欢迎作客我们的php&Laravel学习群:109256050 《Npm Debug Series》是我们课程laravel实战实战系列课程的扩展阅读篇,虽然视频中我们已经将npm install过程中的常见问题及解决方案都说了,但是鉴于npm的问题相对频繁,有随时查阅之需,故有此系列文章。 最近很多小伙伴在使用最新的laravel5.4来学习我

 相关资料
  • The source code has been moved into the main NativeScript monorepo and all issues are handled in the main repo now. This repository is now in read-only mode (archived) for reference. NativeScript Webp

  • NativeScript TypeScript nativescript-dev-typescript is deprecated in favour of bundle workflow, which will be introduced with CLI v6.0. More info about the upcoming new approach can be found here. A p

  • nativescript-dev-appium A package to help with writing and executing e2e Appium tests. Features Requirеments Setup Structure Files Preview Usage Blogs Demos Videos Custom Appium Capabilities Options T

  • 概述 本文主要介绍 canal 产品整体设计,帮助你快速地熟悉代码脉络。如果你对 canal 还一无所知,只是知道他能进行数据迁移同步,那么建议先行阅读 [[Introduction]] 和 [[AdminGuide]] 两篇文档了解。 产品设计 server 代表一个 canal 运行实例,对应于一个 jvm instance 对应于一个数据队列 (1个 canal server 对应 1..n

  • dev-setup 搭建本地开发环境相关文档。

  • Dev C++是一个Windows环境下的一个适合于初学者使用的轻量级 C/C++ 集成开发环境(IDE)。它是一款自由软件,遵守GPL许可协议分发源代码。它集合了MinGW中的GCC编译器、GDB调试器和AStyle格式整理器等众多自由软件。 Dev C++使用MinGW/GCC编译器,遵循C/C++标准。开发环境包括多页面窗口、工程编辑器以及调试器等,在工程编辑器中集合了编辑器、编译器、连接程