简体   繁体   English

Rails pixelarity模板(skel)

[英]Rails pixelarity template (skel)

I want to use in my Rails 4.2.6 app template from pixelarity (like this example http://pixelarity.com/elemental ). 我想在pixelarity的Rails 4.2.6 app模板中使用(比如这个例子http://pixelarity.com/elemental )。

So, I've got interesting construction in main.js (snippet) 所以,我在main.js(片段)中有一个有趣的构造

    skel.init({
    reset: 'full',
    breakpoints: {
        'global':   { range: '*', href: 'style.css', containers: 1400, grid: { gutters: 48 } },
        'wide':     { range: '-1680', href: 'style-wide.css', containers: 1200 },
        'normal':   { range: '-1280', href: 'style-normal.css', containers: '100%', grid: { gutters: 36 } },
        'narrow':   { range: '-960', href: 'style-narrow.css', grid: { gutters: 32 } },
        'narrower': { range: '-840', href: 'style-narrower.css', containers: '100%!', grid: { collapse: true } },
        'mobile':   { range: '-736', href: 'style-mobile.css', grid: { gutters: 20 }, viewport: { scalable: false } }
    },

my layout.html.slim contains 我的layout.html.slim包含

= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"

so, when the resolution will be changed js will plug in another css. 所以,当分辨率改变时,js会插入另一个css。 Perfect! 完善!

But I do not understand how to attach it to my app. 但我不明白如何将它附加到我的应用程序。

If I put files in application.scss it will be loaded for every page, which is wrong, and filename will be changed. 如果我将文件放在application.scss ,它将被加载到每个页面,这是错误的,文件名将被更改。

At this moment I use public dir, where all this stuff works, but it is not right, i feel it (and i have no minifing there). 在这一刻,我使用public目录,所有这些东西都有效,但它不对,我觉得它(我在那里没有minifing)。

How I can use it in rails way? 我如何以rails方式使用它? How I can leave minifing of this css files, and leave them separately with their initial names? 我怎么能留下这个css文件的minifing,并将它们与他们的初始名称分开?

Thank you! 谢谢!

You can achieve this functionality by using css3 media queries. 您可以使用css3媒体查询来实现此功能。 You can read more about CSS3 media queries at following links. 您可以在以下链接中阅读有关CSS3媒体查询的更多信息。

Let me explain what you can do to solve this problem so you can move ahead quickly and read about media queries when you have time. 让我解释一下你可以做些什么来解决这个问题,这样你就可以快速前进,并在有空的时候阅读媒体查询。 You can add all this code in application.scss because it loads in the layout.html.slim. 您可以在application.scss添加所有这些代码,因为它在layout.html.slim中加载。 You can copy the styles of style-mobile.css and paste between the following block of code in the application.scss . 您可以复制样式的style-mobile.css和代码在以下块之间粘贴application.scss

@media (max-width: 736px) {
  // STYLES OF "style-mobile.css" GOES HERE
}

You can copy the styles of style-narrower.css and paste between the following block of code application.scss . 您可以复制style-narrower.css的样式并粘贴到以下代码块application.scss

@media (max-width: 840px) {
  // STYLES OF "style-narrower.css" GOES HERE
}

You can copy the styles of style-narrow.css and paste between the following block of code application.scss . 您可以复制style-narrow.css的样式并粘贴到以下代码块application.scss

@media (max-width: 960px) {
  // STYLES OF "style-narrow.css" GOES HERE
}

You can copy the styles of style-normal.css and paste between the following block of code application.scss . 您可以复制style-normal.css的样式并粘贴到以下代码块application.scss

@media (max-width: 1280px) {
  // STYLES OF "style-normal.css" GOES HERE
}

You can copy the styles of style-wide.css and paste between the following block of code application.scss . 您可以复制style-wide.css的样式并粘贴到以下代码块application.scss

@media (max-width: 1680px) {
  // STYLES OF "style-wide.css" GOES HERE
}

Please check and let me know if you need any help. 如果您需要任何帮助,请检查并告诉我们。

From my experience using Pixelarity on Drupal, I would suggest to include http://pixelarity.com/elemental template in your own index.html (or whatever you name it...), being sure links to required files are correct (all you need is into the pixelarity directory named 'assets'). 根据我在Drupal上使用Pixelarity的经验,我建议将http://pixelarity.com/elemental模板包含在您自己的index.html(或任何您的名字......)中,确保所需文件的链接正确(所有你需要进入名为'assets'的pixelarity目录。 Now, loading you app, you should see elementar in action. 现在,加载你的应用程序,你应该看到elementar在行动。 From there, you can start feeding you app with data produced by your Rail App. 从那里,您可以开始使用您的铁路应用程序生成的数据为您提供应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM