Phoenix LiveView 1.2 Released
AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Before you orderOffer from Amazon

Get the latest gadgets delivered free with Prime

  • Fast, free delivery on millions of items
  • Prime Video, Amazon Music and more included
  • Member-only deals all year
Start your free Prime trial Free trial for eligible customers · Cancel anytime
As an affiliate, we earn on qualifying purchases.

Phoenix LiveView 1.2 has been officially released, adding support for colocated CSS and several small but impactful improvements. The update simplifies styling in LiveView components and enhances template compilation, though full CSS scoping remains experimental.

Phoenix LiveView 1.2 is now available, introducing colocated CSS support and several improvements to template compilation and JavaScript handling, aimed at enhancing developer experience.

The new release, version 1.2, enables developers to colocate CSS within HEEx templates, leveraging the @scope rule and phx-r attributes to scope styles to specific components. This builds upon existing colocated JavaScript features introduced in LiveView 1.1.

While the framework now supports colocated CSS, full CSS scoping using the @scope rule is not yet included due to limited browser support. Instead, LiveView offers a configurable approach with a custom phx-r attribute and a partial implementation of the @scope rule, allowing early adopters to experiment with scoped styles.

Additional improvements include the ability to customize the formatting of <script> and <style> tags, automatic encoding of Phoenix.LiveView.JS structs during push_event, and configurable HEEx debug annotations and test warnings. These updates aim to streamline development workflows and improve debugging capabilities.

Impact of Colocated CSS and Template Enhancements

This update simplifies styling in LiveView applications by allowing CSS to be colocated within components, reducing global style conflicts and improving modularity. Although full CSS scoping is not yet supported across browsers, the partial implementation provides a foundation for more isolated styles, which can benefit complex LiveView interfaces.

The improvements to template compilation and JavaScript handling enhance developer productivity and debugging, making it easier to build and maintain dynamic, real-time web applications with Elixir and Phoenix.

Products Worth Considering

Samsung 49-Inch Odyssey G9 G91F Curved Dual QHD Gaming Monitor, 144Hz

Samsung 49-Inch Odyssey G9 G91F Curved Dual QHD Gaming Monitor, 144Hz

Bose QuietComfort Wireless Noise Cancelling Headphones, Twilight Blue

Bose QuietComfort Wireless Noise Cancelling Headphones, Twilight Blue

DJI Osmo 360 Road Cycling First-Person Combo 360° Action Camera

DJI Osmo 360 Road Cycling First-Person Combo 360° Action Camera

As an affiliate, we earn on qualifying purchases.

Background on LiveView 1.2 Features and Development

LiveView 1.1 introduced colocated hooks and JavaScript, enabling inline scripting within HEEx templates. The 1.2 release extends this approach to CSS, following ongoing discussions about component-scoped styling and the challenges of CSS scoping in browsers.

The development was sponsored by Dashbit and involved significant changes to the HEEx compilation process, including splitting tokenization and parsing steps to support colocated CSS and JS without complicating the overall template compilation.

While the feature set is promising, the team emphasized that full CSS scoping using the @scope rule is experimental, with browser support still limited as of June 2026.

“The release of LiveView 1.2 marks a significant step toward component-based styling, though full scoping remains a work in progress due to browser limitations.”

— an anonymous researcher

Remaining Challenges with CSS Scoping Support

Full CSS scoping via the @scope rule is not yet supported across browsers, and LiveView’s implementation remains experimental. It is unclear when broader browser support will be available or if the feature will be fully integrated into the framework.

Additionally, the long-term adoption of colocated CSS depends on community feedback and further development of the scoping mechanism.

Upcoming Developments and Community Feedback

Developers are encouraged to experiment with the colocated CSS features and provide feedback through forums or issue trackers. The LiveView team plans to monitor browser support and may enhance the scoping capabilities in future releases.

Further updates are expected to include more robust CSS scoping, additional documentation, and potentially broader adoption of colocated styles in production applications.

Key Questions

What is colocated CSS in LiveView 1.2?

Colocated CSS allows developers to define CSS styles directly within HEEx templates, scoped to specific components using attributes and partial support for CSS scoping rules.

Is full CSS scoping supported in LiveView 1.2?

No, full CSS scoping using the @scope rule is not yet supported across browsers. LiveView 1.2 offers partial, experimental support with custom configuration options.

What other improvements are included in LiveView 1.2?

Improvements include customizable formatting for <script> and <style> tags, automatic encoding of JS structs during push_event, and configurable HEEx debug annotations and test warnings.

How do I enable colocated CSS in my project?

Update your mix.exs dependency to ~> 1.2.0 and re-fetch dependencies. Use the <style :type={MyApp.ColocatedCSS}> tag within your HEEx templates to define styles.

What is the significance of this release for Elixir developers?

This release simplifies styling and improves component modularity in LiveView applications, making it easier to build maintainable, real-time web interfaces.

Source: Hacker News


You May Also Like

Cleveland Schools Are Pioneering Robotics, Offering a Glimpse Into Ohio’s High-Tech Future.

Harnessing innovative robotics programs, Cleveland Schools are shaping Ohio’s high-tech future—discover how these initiatives are transforming education and industry.

Elon Musk’S Bold Blockchain Initiative Promises to Radically Change Government Expenditure.

Musk’s groundbreaking blockchain initiative could revolutionize government spending, but will it truly enhance transparency and efficiency in public services?

Technology operations signal monitor: How Google helped destroy adoption of RSS feeds (2023)

A recent analysis shows how Google’s platform and tooling changes contributed to the decline of RSS feed usage, impacting small software companies’ awareness of tech shifts.

Mirrorless Camera Buying Guide: Sensor Size Matters Less Than You Think

Discover why sensor size isn’t the only factor in choosing a mirrorless camera and what truly impacts your photography success.